mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 01:55:40 +00:00
Fix typos
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
//!
|
||||
//! ## Organisation
|
||||
//!
|
||||
//! Database functionallity is divided accross various modules:
|
||||
//! Database functionality is divided across various modules:
|
||||
//!
|
||||
//! - [errors](crate::auth): error data structures used in this crate
|
||||
//! - [ops](crate::ops): meta operations like connection pool creation, migrations and getting
|
||||
@@ -242,13 +242,13 @@ pub trait MCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
|
||||
/// record PoWConfig confirms
|
||||
async fn record_confirm(&self, key: &str) -> DBResult<()>;
|
||||
|
||||
/// featch PoWConfig fetches
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ pub struct AddNotification<'a> {
|
||||
pub from: &'a str,
|
||||
/// heading of the notification
|
||||
pub heading: &'a str,
|
||||
/// mesage of the notification
|
||||
/// message of the notification
|
||||
pub message: &'a str,
|
||||
}
|
||||
|
||||
@@ -298,12 +298,12 @@ pub struct TrafficPattern {
|
||||
pub avg_traffic: u32,
|
||||
/// the peak traffic that the user's website can handle
|
||||
pub peak_sustainable_traffic: u32,
|
||||
/// trafic that bought the user's website down; optional
|
||||
/// traffic that bought the user's website down; optional
|
||||
pub broke_my_site_traffic: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
|
||||
/// data requried to create new captcha
|
||||
/// data required to create new captcha
|
||||
pub struct CreateCaptcha<'a> {
|
||||
/// cool down duration
|
||||
pub duration: i32,
|
||||
|
||||
@@ -30,7 +30,7 @@ pub trait GetConnection {
|
||||
async fn get_conn(&self) -> DBResult<Self::Conn>;
|
||||
}
|
||||
|
||||
/// Create databse connection
|
||||
/// Create database connection
|
||||
#[async_trait]
|
||||
pub trait Connect {
|
||||
/// database specific pool-type
|
||||
|
||||
@@ -33,7 +33,7 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
db.delete_user(p.username).await.unwrap();
|
||||
assert!(
|
||||
!db.username_exists(p.username).await.unwrap(),
|
||||
"user is deleted so username shouldn't exsit"
|
||||
"user is deleted so username shouldn't exist"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
// testing email exists
|
||||
assert!(
|
||||
db.email_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user is registered so email should exsit"
|
||||
"user is registered so email should exist"
|
||||
);
|
||||
assert!(
|
||||
db.username_exists(p.username).await.unwrap(),
|
||||
"user is registered so username should exsit"
|
||||
"user is registered so username should exist"
|
||||
);
|
||||
|
||||
// update password test. setting password = username
|
||||
@@ -124,7 +124,7 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
db.delete_user(p.email.as_ref().unwrap()).await.unwrap();
|
||||
assert!(
|
||||
!db.username_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user is deleted so username shouldn't exsit"
|
||||
"user is deleted so username shouldn't exist"
|
||||
);
|
||||
|
||||
// register with email = None
|
||||
@@ -133,11 +133,11 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
db.register(&p2).await.unwrap();
|
||||
assert!(
|
||||
db.username_exists(p2.username).await.unwrap(),
|
||||
"user is registered so username should exsit"
|
||||
"user is registered so username should exist"
|
||||
);
|
||||
assert!(
|
||||
!db.email_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user registration with email is deleted; so email shouldn't exsit"
|
||||
"user registration with email is deleted; so email shouldn't exist"
|
||||
);
|
||||
|
||||
// testing get_email = None
|
||||
@@ -155,7 +155,7 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
);
|
||||
assert!(
|
||||
db.email_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user was with empty email but email is set; so email should exsit"
|
||||
"user was with empty email but email is set; so email should exist"
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct Database {
|
||||
/// Use an existing database pool
|
||||
pub struct Conn(pub MySqlPool);
|
||||
|
||||
/// Connect to databse
|
||||
/// Connect to database
|
||||
pub enum ConnectionOptions {
|
||||
/// fresh connection
|
||||
Fresh(Fresh),
|
||||
@@ -824,7 +824,7 @@ impl MCDatabase for Database {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// featch PoWConfig fetches
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -850,7 +850,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -874,7 +874,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct Database {
|
||||
/// Use an existing database pool
|
||||
pub struct Conn(pub PgPool);
|
||||
|
||||
/// Connect to databse
|
||||
/// Connect to database
|
||||
pub enum ConnectionOptions {
|
||||
/// fresh connection
|
||||
Fresh(Fresh),
|
||||
@@ -830,7 +830,7 @@ impl MCDatabase for Database {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// featch PoWConfig fetches
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -856,7 +856,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -880,7 +880,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
|
||||
Reference in New Issue
Block a user