From 52026bb0f1866ebc27dde99ffd69c3ffac2892da Mon Sep 17 00:00:00 2001 From: Ginger Date: Mon, 29 Jun 2026 09:41:59 -0400 Subject: [PATCH] chore: Formatting --- src/admin/token/commands.rs | 9 ++++----- src/service/users/account.rs | 28 +++++++++++++++------------- src/service/users/mod.rs | 4 +--- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/admin/token/commands.rs b/src/admin/token/commands.rs index 7a3f9eee5..0e5ae6132 100644 --- a/src/admin/token/commands.rs +++ b/src/admin/token/commands.rs @@ -3,8 +3,7 @@ use service::registration_tokens::TokenExpires; impl crate::Context<'_> { - -pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result { + pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result { let expires = { if expires.immortal { None @@ -30,7 +29,7 @@ pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result { .services .registration_tokens .issue_token(self.sender_or_service_user().into(), expires); - + self.write_str(&format!( "New registration token issued: `{token}` . {}.", if let Some(expires) = info.expires { @@ -40,7 +39,7 @@ pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result { } )) .await?; - + if self .services .config @@ -61,7 +60,7 @@ pub(super) async fn issue_token(&self, expires: super::TokenExpires) -> Result { )) .await?; } - + Ok(()) } diff --git a/src/service/users/account.rs b/src/service/users/account.rs index 88354064d..d663e7940 100644 --- a/src/service/users/account.rs +++ b/src/service/users/account.rs @@ -1,17 +1,27 @@ use std::time::{Duration, SystemTime}; use conduwuit::{ - Err, Result, debug_error, debug_warn, err, error, info, trace, utils::{self, ReadyExt, stream::TryIgnore}, warn, + Err, Result, debug_error, debug_warn, err, error, info, trace, + utils::{self, ReadyExt, stream::TryIgnore}, + warn, }; use database::{Deserialized, Json}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt}; use lettre::Address; use ruma::{ - MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, UserId, events::{GlobalAccountDataEventType, ignored_user_list::IgnoredUserListEvent, push_rules::PushRulesEvent, room::message::RoomMessageEventContent}, push::Ruleset, + MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, UserId, + events::{ + GlobalAccountDataEventType, ignored_user_list::IgnoredUserListEvent, + push_rules::PushRulesEvent, room::message::RoomMessageEventContent, + }, + push::Ruleset, }; use ruminuwuity::invite_permission_config::{FilterLevel, InvitePermissionConfigEvent}; -use crate::{appservice::RegistrationInfo, users::{HashedPassword, UserSuspension}}; +use crate::{ + appservice::RegistrationInfo, + users::{HashedPassword, UserSuspension}, +}; /// The status of an access token. pub enum AccessTokenStatus { @@ -83,11 +93,7 @@ pub async fn is_admin(&self, user_id: &UserId) -> bool { /// to create a non-local user. Non-local users with a password will return /// an error. #[inline] - pub fn create( - &self, - user_id: &UserId, - password: Option, - ) -> Result<()> { + pub fn create(&self, user_id: &UserId, password: Option) -> Result<()> { if !self.services.globals.user_is_local(user_id) && password.is_some() { return Err!("Cannot create a nonlocal user with a set password"); } @@ -543,11 +549,7 @@ pub fn set_password(&self, user_id: &UserId, password: Option) { } /// Check a user's password. - pub async fn check_password( - &self, - user_id: &UserId, - password: &str, - ) -> Result { + pub async fn check_password(&self, user_id: &UserId, password: &str) -> Result { let (hash, user_id): (String, OwnedUserId) = if let Ok(hash) = self.db.userid_password.get(user_id).await.deserialized() { (hash, user_id.to_owned()) diff --git a/src/service/users/mod.rs b/src/service/users/mod.rs index 0e915012e..ae4d47ef9 100644 --- a/src/service/users/mod.rs +++ b/src/service/users/mod.rs @@ -17,9 +17,7 @@ use serde::{Deserialize, Serialize}; use crate::{ - Dep, account_data, admin, - appservice, - config, firstrun, globals, oauth, + Dep, account_data, admin, appservice, config, firstrun, globals, oauth, rooms::{self, alias, membership}, threepid, };