mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
chore: Clippy fixes
This commit is contained in:
@@ -286,7 +286,7 @@ pub(crate) async fn deactivate_route(
|
|||||||
// Prompt the user to confirm with their password using UIAA
|
// Prompt the user to confirm with their password using UIAA
|
||||||
let _ = services
|
let _ = services
|
||||||
.uiaa
|
.uiaa
|
||||||
.authenticate_password(&body.auth, &sender_user, identity.sender_device(), None)
|
.authenticate_password(&body.auth, sender_user, identity.sender_device(), None)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Remove profile pictures and display name
|
// Remove profile pictures and display name
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::{
|
|||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use conduwuit::{Result, utils::hash::sha256};
|
use conduwuit::{Result, utils::hash::sha256};
|
||||||
use database::{Deserialized, Json, Map};
|
use database::{Deserialized, Json, Map};
|
||||||
use ruma::{DeviceId, OwnedUserId, UserId};
|
use ruma::DeviceId;
|
||||||
|
|
||||||
use crate::{Dep, config, oauth::client_metadata::ClientMetadata};
|
use crate::{Dep, config, oauth::client_metadata::ClientMetadata};
|
||||||
|
|
||||||
@@ -36,6 +36,7 @@ pub enum OAuthTicket {
|
|||||||
impl OAuthTicket {
|
impl OAuthTicket {
|
||||||
const MAX_AGE: Duration = Duration::from_mins(10);
|
const MAX_AGE: Duration = Duration::from_mins(10);
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn ticket_issue_path(&self) -> &'static str {
|
pub fn ticket_issue_path(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
| Self::CrossSigningReset => "/account/cross_signing_reset",
|
| Self::CrossSigningReset => "/account/cross_signing_reset",
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ enum UiaaSessionMetadata {
|
|||||||
impl UiaaSessionMetadata {
|
impl UiaaSessionMetadata {
|
||||||
fn into_identity(self) -> Identity {
|
fn into_identity(self) -> Identity {
|
||||||
match self {
|
match self {
|
||||||
| UiaaSessionMetadata::Legacy { identity } => identity,
|
| Self::Legacy { identity } => identity,
|
||||||
| UiaaSessionMetadata::OAuth { localpart, .. } =>
|
| Self::OAuth { localpart, .. } =>
|
||||||
assign!(Identity::default(), { localpart: Some(localpart) }),
|
assign!(Identity::default(), { localpart: Some(localpart) }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,10 +98,12 @@ pub struct UiaaInitiator<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UiaaInitiator<'a> {
|
impl<'a> UiaaInitiator<'a> {
|
||||||
|
#[must_use]
|
||||||
pub fn new(user_id: &'a UserId, device_id: Option<&'a DeviceId>) -> Self {
|
pub fn new(user_id: &'a UserId, device_id: Option<&'a DeviceId>) -> Self {
|
||||||
Self { user_id, device_id, oauth_ticket: None }
|
Self { user_id, device_id, oauth_ticket: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn with_oauth_ticket(
|
pub fn with_oauth_ticket(
|
||||||
user_id: &'a UserId,
|
user_id: &'a UserId,
|
||||||
device_id: Option<&'a DeviceId>,
|
device_id: Option<&'a DeviceId>,
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
use axum::{Router, extract::State, routing::on};
|
use axum::{Router, extract::State, routing::on};
|
||||||
use conduwuit_api::client::full_user_deactivate;
|
use conduwuit_api::client::full_user_deactivate;
|
||||||
use conduwuit_service::oauth::OAuthTicket;
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{OwnedRoomId, OwnedUserId, UserId};
|
use ruma::{OwnedRoomId, OwnedUserId, UserId};
|
||||||
use serde::Deserialize;
|
|
||||||
use tower_sessions::Session;
|
use tower_sessions::Session;
|
||||||
use validator::{Validate, ValidationError, ValidationErrors};
|
use validator::{Validate, ValidationError, ValidationErrors};
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ use ruma::{
|
|||||||
OwnedUserId,
|
OwnedUserId,
|
||||||
api::client::uiaa::{EmailUserIdentifier, MatrixUserIdentifier, UserIdentifier},
|
api::client::uiaa::{EmailUserIdentifier, MatrixUserIdentifier, UserIdentifier},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Deserialize;
|
||||||
use tower_sessions::Session;
|
use tower_sessions::Session;
|
||||||
use validator::Validate;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
WebError,
|
WebError,
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
use axum::{
|
use axum::{Router, extract::State, response::Response, routing::get};
|
||||||
Router,
|
|
||||||
extract::State,
|
|
||||||
response::{IntoResponse, Response},
|
|
||||||
routing::get,
|
|
||||||
};
|
|
||||||
use conduwuit_service::threepid::EmailRequirement;
|
use conduwuit_service::threepid::EmailRequirement;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{OwnedClientSecret, OwnedSessionId};
|
use ruma::{OwnedClientSecret, OwnedSessionId};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use askama::{Template, filters::HtmlSafe};
|
use askama::{Template, filters::HtmlSafe};
|
||||||
use validator::{ValidationError, ValidationErrors};
|
use validator::ValidationErrors;
|
||||||
|
|
||||||
/// A reusable form component with field validation.
|
/// A reusable form component with field validation.
|
||||||
#[derive(Debug, Template)]
|
#[derive(Debug, Template)]
|
||||||
|
|||||||
@@ -116,9 +116,11 @@ impl DeviceCard {
|
|||||||
let display_name = oauth_metadata
|
let display_name = oauth_metadata
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|metadata| metadata.client_name.clone())
|
.and_then(|metadata| metadata.client_name.clone())
|
||||||
.or(device
|
.or_else(|| {
|
||||||
.as_ref()
|
device
|
||||||
.and_then(|device| device.display_name.clone()));
|
.as_ref()
|
||||||
|
.and_then(|device| device.display_name.clone())
|
||||||
|
});
|
||||||
|
|
||||||
let avatar_src = oauth_metadata
|
let avatar_src = oauth_metadata
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ macro_rules! template {
|
|||||||
) => {
|
) => {
|
||||||
#[derive(Debug, askama::Template)]
|
#[derive(Debug, askama::Template)]
|
||||||
#[template(path = $path)]
|
#[template(path = $path)]
|
||||||
#[allow(clippy::useless_let_if_seq)]
|
|
||||||
struct $name$(<$lifetime>)? {
|
struct $name$(<$lifetime>)? {
|
||||||
context: $crate::pages::TemplateContext,
|
context: $crate::pages::TemplateContext,
|
||||||
$($field_name: $field_type,)*
|
$($field_name: $field_type,)*
|
||||||
|
|||||||
@@ -5,13 +5,12 @@ Reset your password
|
|||||||
{%- endblock -%}
|
{%- endblock -%}
|
||||||
|
|
||||||
{%- block content -%}
|
{%- block content -%}
|
||||||
{% decl body_class -%}
|
{% match body %}
|
||||||
{% if let ResetPasswordRequestBody::Unavailable = body -%}
|
{% when ResetPasswordRequestBody::Form(_) %}
|
||||||
{% let body_class = "panel middle" -%}
|
<div class="panel">
|
||||||
{% else -%}
|
{% when ResetPasswordRequestBody::Unavailable %}
|
||||||
{% let body_class = "panel" -%}
|
<div class="panel middle"/>
|
||||||
{% endif -%}
|
{% endmatch %}
|
||||||
<div class="{{ body_class }}">
|
|
||||||
<h1>Reset your password</h1>
|
<h1>Reset your password</h1>
|
||||||
{% match body %}
|
{% match body %}
|
||||||
{% when ResetPasswordRequestBody::Form(form) %}
|
{% when ResetPasswordRequestBody::Form(form) %}
|
||||||
|
|||||||
Reference in New Issue
Block a user