mirror of
https://github.com/lldap/lldap.git
synced 2026-07-25 17:58:44 +00:00
server: Implement password reset
It's still missing the email. This also secures the password change method with a JWT token check: you have to be logged in to change the password.
This commit is contained in:
committed by
nitnelave
parent
7b5ad47ee2
commit
a13bfc3575
@@ -151,4 +151,13 @@ impl TcpBackendHandler for SqlBackendHandler {
|
||||
let (user_id,) = sqlx::query_as(&query).fetch_one(&self.sql_pool).await?;
|
||||
Ok(user_id)
|
||||
}
|
||||
|
||||
async fn delete_password_reset_token(&self, token: &str) -> Result<()> {
|
||||
let query = Query::delete()
|
||||
.from_table(PasswordResetTokens::Table)
|
||||
.and_where(Expr::col(PasswordResetTokens::Token).eq(token))
|
||||
.to_string(DbQueryBuilder {});
|
||||
sqlx::query(&query).execute(&self.sql_pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user