Skip to main content

set_password

Function set_password 

Source
pub async fn set_password(
    username: &str,
    plaintext: &str,
    context: &PasswordContext,
    database: Arc<Database>,
) -> Result<Option<(AdminUser, u64)>, UserError>
Expand description

Replaces an operator’s password and revokes every session they hold.

The revocation is the point: a password changed because it may have leaked, that left the leaked session alive, would be a change in name only. Returns None when there is no such user; otherwise the operator and how many sessions the change took with it, for the caller’s session_revoked row.