Simplified Handler::new
This commit is contained in:
@ -7,14 +7,13 @@ async fn get_master_pass(
|
||||
msg: Message,
|
||||
db: DatabaseConnection,
|
||||
dialogue: MainDialogue,
|
||||
master_password: String,
|
||||
master_pass: String,
|
||||
) -> crate::Result<()> {
|
||||
dialogue.exit().await?;
|
||||
let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
|
||||
let model = spawn_blocking(move || {
|
||||
master_pass::ActiveModel::from_unencrypted(user_id, &master_password)
|
||||
})
|
||||
.await?;
|
||||
let model =
|
||||
spawn_blocking(move || master_pass::ActiveModel::from_unencrypted(user_id, &master_pass))
|
||||
.await?;
|
||||
model.insert(&db).await?;
|
||||
bot.send_message(msg.chat.id, "Success")
|
||||
.reply_markup(deletion_markup())
|
||||
@ -41,7 +40,9 @@ pub async fn set_master_pass(
|
||||
.await?;
|
||||
dialogue
|
||||
.update(State::GetNewMasterPass(Handler::new(
|
||||
get_master_pass,
|
||||
|bot, msg, db, dialogue, master_pass| {
|
||||
Box::pin(get_master_pass(bot, msg, db, dialogue, master_pass))
|
||||
},
|
||||
&previous,
|
||||
)))
|
||||
.await?;
|
||||
|
Reference in New Issue
Block a user