fix: check for user account status before attemping to process email change.

This commit is contained in:
Clubs authored and Ellis Git committed 2026-09-29 18:36:35 +00:00
1 parent cbdf978b84
commit 684820c7c1
2 files changed
+4

No files matched your search

+1
View File
@@ -0,0 +1 @@
"!admin users change-email" now verifies a user exists before attempting to change their email. Contributed by @Clubs.
+3
View File
@@ -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.");
};