pass_manager/src/state/get_password.rs

21 lines
453 B
Rust
Raw Normal View History

use crate::prelude::*;
2023-05-03 18:08:14 +00:00
2023-07-16 20:12:37 +00:00
#[inline]
async fn check_password(
_: &Message,
2023-07-16 20:12:37 +00:00
_: &DatabaseConnection,
password: &str,
) -> crate::Result<Option<String>> {
let is_valid = validate_field(password);
2023-07-16 20:12:37 +00:00
if !is_valid {
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"
);