mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 12:46:49 +00:00
chore: Move registration notice logic
This commit is contained in:
5 files changed
+39
-33
No files matched your search
@@ -1,4 +1,7 @@
|
||||
use std::time::{Duration, SystemTime};
|
||||
use std::{
|
||||
net::IpAddr,
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
use conduwuit::{
|
||||
Err, Result, debug_error, debug_warn, err, error, info, trace,
|
||||
@@ -136,6 +139,8 @@ impl super::Service {
|
||||
user_id: &UserId,
|
||||
password: Option<HashedPassword>,
|
||||
email: Option<Address>,
|
||||
client: Option<&IpAddr>,
|
||||
device_name: Option<&str>,
|
||||
) -> Result<()> {
|
||||
self.create_shadow_account(user_id).await?;
|
||||
|
||||
@@ -143,6 +148,22 @@ impl super::Service {
|
||||
self.convert_to_local_account(user_id, password).await?;
|
||||
}
|
||||
|
||||
if let Some(client) = client {
|
||||
let notice = if let Some(device_name) = device_name {
|
||||
format!(
|
||||
"New user \"{user_id}\" registered on this server from IP {client} and \
|
||||
device display name \"{device_name}\".",
|
||||
)
|
||||
} else {
|
||||
format!("New user \"{user_id}\" registered on this server from IP {client}.")
|
||||
};
|
||||
info!("{notice}");
|
||||
|
||||
if self.services.config.admin_room_notices {
|
||||
self.services.admin.notice(¬ice).await;
|
||||
}
|
||||
}
|
||||
|
||||
// Set an initial display name
|
||||
{
|
||||
let mut displayname = user_id.localpart().to_owned();
|
||||
|
||||
Reference in new issue
Block a user