mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-14 13:08:27 +03:00
feat: implement update secret interface for sqlx postgres
This commit is contained in:
parent
d4a080b5fc
commit
ec6b49c2e1
1 changed files with 14 additions and 0 deletions
|
@ -264,6 +264,20 @@ impl MCDatabase for Database {
|
|||
|
||||
Ok(secret)
|
||||
}
|
||||
|
||||
/// update a user's secret
|
||||
async fn update_secret(&self, username: &str, secret: &str) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_users set secret = $1
|
||||
WHERE name = $2",
|
||||
&secret,
|
||||
&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