pub async fn set_password<S: AuthSchema>(
request: &AuthRequest,
new_password: &str,
context: &AuthContext<S>,
) -> AuthResult<()>Expand description
Set the authenticated user’s password when no password is currently set.
This is a trusted server API, with no public authentication route and no target user selector. It re-reads the signed-cookie session from physical storage; cached or hook-provided virtual sessions cannot authorize credential changes. The initialized email/password policy and custom hasher apply. Existing sessions remain active, and the configured hasher runs even when an existing password will subsequently cause rejection.
§Errors
Returns an authentication error for absent or invalid authoritative sessions,
password-bound errors, PASSWORD_ALREADY_SET, or a storage/hasher error.