mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-14 13:08:27 +03:00
feat: implement updating captcha metadata for sqlx postgres
This commit is contained in:
parent
1e6a259d57
commit
6b10ed6982
1 changed files with 21 additions and 0 deletions
|
@ -296,6 +296,27 @@ impl MCDatabase for Database {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// update captcha metadata; doesn't change captcha key
|
||||
async fn update_captcha_metadata(
|
||||
&self,
|
||||
username: &str,
|
||||
p: &CreateCaptcha,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_config SET name = $1, duration = $2
|
||||
WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = $3)
|
||||
AND key = $4",
|
||||
p.description,
|
||||
p.duration,
|
||||
username,
|
||||
p.key,
|
||||
)
|
||||
.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