2023-06-29 14:33:26 +00:00
|
|
|
use crate::prelude::*;
|
2023-05-03 18:08:14 +00:00
|
|
|
|
2023-07-16 20:12:37 +00:00
|
|
|
#[inline]
|
|
|
|
async fn check_password(
|
2023-07-25 21:52:12 +00:00
|
|
|
_: &Message,
|
2023-07-16 20:12:37 +00:00
|
|
|
_: &DatabaseConnection,
|
2023-07-25 21:52:12 +00:00
|
|
|
password: &str,
|
|
|
|
) -> crate::Result<Option<String>> {
|
|
|
|
let is_valid = validate_field(password);
|
2023-07-16 20:12:37 +00:00
|
|
|
if !is_valid {
|
2023-07-25 21:52:12 +00:00
|
|
|
return Ok(Some("Invalid password. Try again".to_owned()));
|
2023-07-16 20:12:37 +00:00
|
|
|
}
|
|
|
|
Ok(None)
|
2023-05-03 18:08:14 +00:00
|
|
|
}
|
2023-07-16 20:12:37 +00:00
|
|
|
|
|
|
|
crate::simple_state_handler!(
|
|
|
|
get_password,
|
|
|
|
check_password,
|
|
|
|
"Couldn't get the text of the message. Send the password again"
|
|
|
|
);
|