mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-10-22 14:21:19 +00:00
fix: check for user account status before attemping to process email change.
This commit is contained in:
1 parent
cbdf978b84
commit
684820c7c1
2 files changed
+4
No files matched your search
@@ -0,0 +1 @@
|
||||
"!admin users change-email" now verifies a user exists before attempting to change their email. Contributed by @Clubs.
|
||||
@@ -1083,6 +1083,9 @@ pub(super) async fn get_user_by_email(&self, email: String) -> Result {
|
||||
|
||||
pub(super) async fn change_email(&self, user_id: String, email: Option<String>) -> Result {
|
||||
let user_id = parse_local_user_id(self.services, &user_id)?;
|
||||
if matches!(self.services.users.status(&user_id).await, AccountStatus::NotFound) {
|
||||
return Err!("This account does not exist.");
|
||||
}
|
||||
let Ok(new_email) = email.map(Address::try_from).transpose() else {
|
||||
return Err!("Invalid email address.");
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user