mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-14 13:08:27 +03:00
feat: define get captcha cooldown period interface
This commit is contained in:
parent
9d7bb3c0be
commit
09a8591cb4
2 changed files with 6 additions and 0 deletions
|
@ -183,6 +183,9 @@ pub trait MCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
|
|||
username: Option<&str>,
|
||||
captcha_key: &str,
|
||||
) -> DBResult<Vec<Level>>;
|
||||
|
||||
/// Get captcha's cooldown period
|
||||
async fn get_captcha_cooldown(&self, captcha_key: &str) -> DBResult<i32>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
|
|
@ -136,6 +136,9 @@ pub async fn database_works<'a, T: MCDatabase>(
|
|||
assert!(db.captcha_exists(None, c.key).await.unwrap());
|
||||
assert!(db.captcha_exists(Some(p.username), c.key).await.unwrap());
|
||||
|
||||
// get captcha cooldown duration
|
||||
assert_eq!(db.get_captcha_cooldown(c.key).await.unwrap(), c.duration);
|
||||
|
||||
// add captcha levels
|
||||
db.add_captcha_levels(p.username, c.key, l).await.unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue