Renamed fucntion for verifying master password

This commit is contained in:
StNicolay 2023-01-11 17:53:57 +03:00
parent 931e93fbde
commit aa36f2eb82
2 changed files with 8 additions and 8 deletions

View File

@ -82,7 +82,7 @@ async def _delete_all2(
) -> None: ) -> None:
await base_handler(bot, mes, prev_mes) await base_handler(bot, mes, prev_mes)
text = mes.text.strip() text = mes.text.strip()
if encryption.master_pass.check_master_pass(text, master_pass): if encryption.master_pass.verify_master_pass(text, master_pass):
db.delete.purge_accounts(engine, mes.from_user.id) db.delete.purge_accounts(engine, mes.from_user.id)
db.delete.delete_master_pass(engine, mes.from_user.id) db.delete.delete_master_pass(engine, mes.from_user.id)
await send_tmp_message( await send_tmp_message(
@ -181,7 +181,7 @@ async def _reset_master_pass2(
if text == "/cancel": if text == "/cancel":
await send_tmp_message(bot, mes.chat.id, "Успешная отмена") await send_tmp_message(bot, mes.chat.id, "Успешная отмена")
if not encryption.master_pass.check_master_pass(text, master_pass): if not encryption.master_pass.verify_master_pass(text, master_pass):
await send_tmp_message(bot, mes.chat.id, "Неверный мастер пароль") await send_tmp_message(bot, mes.chat.id, "Неверный мастер пароль")
return return
@ -334,7 +334,7 @@ async def _add_account5(
return await send_tmp_message(bot, mes.chat.id, "Успешная отмена") return await send_tmp_message(bot, mes.chat.id, "Успешная отмена")
master_password = db.get.get_master_pass(engine, mes.from_user.id) master_password = db.get.get_master_pass(engine, mes.from_user.id)
if not encryption.master_pass.check_master_pass(text, master_password): if not encryption.master_pass.verify_master_pass(text, master_password):
return await send_tmp_message( return await send_tmp_message(
bot, bot,
mes.chat.id, mes.chat.id,
@ -424,7 +424,7 @@ async def _get_account3(
mes.from_user.id, mes.from_user.id,
) )
if not encryption.master_pass.check_master_pass(text, master_password): if not encryption.master_pass.verify_master_pass(text, master_password):
return await send_tmp_message( return await send_tmp_message(
bot, bot,
mes.chat.id, mes.chat.id,
@ -518,7 +518,7 @@ async def _delete_account3(
) -> None: ) -> None:
await base_handler(bot, mes, prev_mes) await base_handler(bot, mes, prev_mes)
text = mes.text.strip() text = mes.text.strip()
if not encryption.master_pass.check_master_pass(text, master_pass): if not encryption.master_pass.verify_master_pass(text, master_pass):
await send_tmp_message(bot, mes.chat.id, "Неверный пароль") await send_tmp_message(bot, mes.chat.id, "Неверный пароль")
return return
@ -574,7 +574,7 @@ async def _export2(
engine, engine,
mes.from_user.id, mes.from_user.id,
) )
if not encryption.master_pass.check_master_pass(text, master_password): if not encryption.master_pass.verify_master_pass(text, master_password):
return await send_tmp_message( return await send_tmp_message(
bot, bot,
mes.chat.id, mes.chat.id,
@ -682,7 +682,7 @@ async def _import3(
engine, engine,
mes.from_user.id, mes.from_user.id,
) )
if not encryption.master_pass.check_master_pass(text, master_password): if not encryption.master_pass.verify_master_pass(text, master_password):
return await send_tmp_message( return await send_tmp_message(
bot, bot,
mes.chat.id, mes.chat.id,

View File

@ -31,7 +31,7 @@ def encrypt_master_pass(user_id: int, password: str) -> MasterPass:
) )
def check_master_pass(password: str, master_password: MasterPass) -> bool: def verify_master_pass(password: str, master_password: MasterPass) -> bool:
"""Checks if the master password is correct""" """Checks if the master password is correct"""
kdf = _get_kdf(master_password.salt) kdf = _get_kdf(master_password.salt)
try: try: