chore: Formatting

This commit is contained in:
Ginger
2026-06-29 09:41:59 -04:00
parent aed8e7d769
commit 52026bb0f1
3 changed files with 20 additions and 21 deletions
+4 -5
View File
@@ -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(())
}
+15 -13
View File
@@ -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<HashedPassword>,
) -> Result<()> {
pub fn create(&self, user_id: &UserId, password: Option<HashedPassword>) -> 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<HashedPassword>) {
}
/// Check a user's password.
pub async fn check_password(
&self,
user_id: &UserId,
password: &str,
) -> Result<OwnedUserId> {
pub async fn check_password(&self, user_id: &UserId, password: &str) -> Result<OwnedUserId> {
let (hash, user_id): (String, OwnedUserId) =
if let Ok(hash) = self.db.userid_password.get(user_id).await.deserialized() {
(hash, user_id.to_owned())
+1 -3
View File
@@ -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,
};