mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-14 13:08:27 +03:00
feat: implement update_captcha_key for sqlx postgres
This commit is contained in:
parent
e2ebae6e2e
commit
b2d32c6113
1 changed files with 20 additions and 0 deletions
|
@ -317,6 +317,26 @@ impl MCDatabase for Database {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// update captcha key; doesn't change metadata
|
||||
async fn update_captcha_key(
|
||||
&self,
|
||||
username: &str,
|
||||
old_key: &str,
|
||||
new_key: &str,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_config SET key = $1
|
||||
WHERE key = $2 AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $3)",
|
||||
new_key,
|
||||
old_key,
|
||||
username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(map_register_err)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Add levels to captcha
|
||||
async fn add_captcha_levels(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Reference in a new issue