mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-08-28 14:24:10 +00:00
chore: Formatting
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user