feat: Implement a command for issuing password reset links

This commit is contained in:
Ginger committed 2026-03-18 12:42:55 -04:00
1 parent 267feb3c09
commit da8833fca4
7 files changed
+56 -1

No files matched your search

+6
View File
@@ -8,6 +8,8 @@ use ruma::OwnedUserId;
use crate::{Dep, globals, users};
pub const PASSWORD_RESET_PATH: &str = "/_continuwuity/password_reset";
pub const RESET_TOKEN_QUERY_PARAM: &str = "token";
const RESET_TOKEN_LENGTH: usize = 32;
pub struct Service {
@@ -52,6 +54,10 @@ impl Service {
return Err!("Cannot issue a password reset token for remote user {user}");
}
if user == self.services.globals.server_user {
return Err!("Cannot issue a password reset token for the server user");
}
if self.services.users.origin(&user).await? != "password" {
return Err!("Cannot issue a password reset token for non-internal user {user}");
}