pass_manager/src/state/get_password.rs

17 lines
424 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]
2024-02-03 13:23:39 +00:00
async fn check_password(_: &Message, _: &Pool, 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"
);