mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-02-17 08:59:46 +03:00
feat: implement change password for sqlx postgres
This commit is contained in:
parent
f55a383eb5
commit
374bbb2403
1 changed files with 15 additions and 0 deletions
|
@ -222,6 +222,21 @@ impl MCDatabase for Database {
|
|||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// update user's password
|
||||
async fn update_password(&self, p: &NameHash) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_users set password = $1
|
||||
WHERE name = $2",
|
||||
&p.hash,
|
||||
&p.username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(map_register_err)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn now_unix_time_stamp() -> i64 {
|
||||
|
|
Loading…
Add table
Reference in a new issue