redirect: when logging in to ezidam, if user has expired password reset token, delete it
This commit is contained in:
parent
da4b204601
commit
0baeeadce9
3 changed files with 22 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ use id::UserID;
|
|||
use serde::Serialize;
|
||||
|
||||
pub use crate::error::Error;
|
||||
use crate::password_reset::{Error as PasswordResetTokenError, PasswordResetToken};
|
||||
|
||||
#[derive(Serialize, Debug, Clone)]
|
||||
pub struct User {
|
||||
|
|
@ -64,4 +65,10 @@ impl User {
|
|||
pub fn totp_backup_hashed(&self) -> Option<&str> {
|
||||
self.totp_backup.as_deref()
|
||||
}
|
||||
pub fn password_recover(&self) -> Result<Option<PasswordResetToken>, PasswordResetTokenError> {
|
||||
self.password_recover
|
||||
.as_deref()
|
||||
.map(PasswordResetToken::parse)
|
||||
.transpose()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue