Compare commits
2 Commits
2a5b594f3f
...
0d3965d5d2
Author | SHA1 | Date | |
---|---|---|---|
0d3965d5d2 | |||
04bb306751 |
@ -7,14 +7,14 @@ import pydantic
|
||||
class _Account(pydantic.BaseModel):
|
||||
name: str
|
||||
login: str
|
||||
passwd: str
|
||||
password: str
|
||||
|
||||
@classmethod
|
||||
def from_tuple(cls: Type[Self], tuple_: tuple[str, str, str]) -> Self:
|
||||
return cls(name=tuple_[0], login=tuple_[1], passwd=tuple_[2])
|
||||
|
||||
def as_tuple(self: Self) -> tuple[str, str, str]:
|
||||
return (self.name, self.login, self.passwd)
|
||||
return (self.name, self.login, self.password)
|
||||
|
||||
|
||||
class _Accounts(pydantic.BaseModel):
|
||||
|
@ -365,6 +365,7 @@ def help(bot: telebot.TeleBot, mes: Message) -> None:
|
||||
|
||||
|
||||
def cancel(bot: telebot.TeleBot, mes: Message) -> None:
|
||||
_base_handler(bot, mes)
|
||||
_send_tmp_message(bot, mes.chat.id, "Нет активного действия")
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ def add_account(
|
||||
name=name,
|
||||
salt=salt,
|
||||
enc_login=enc_login,
|
||||
enc_pass=enc_password,
|
||||
enc_password=enc_password,
|
||||
)
|
||||
try:
|
||||
with sqlmodel.Session(engine) as session:
|
||||
@ -41,7 +41,7 @@ def add_master_pass(
|
||||
master_pass = models.MasterPass(
|
||||
user_id=user_id,
|
||||
salt=salt,
|
||||
passwd=password_hash,
|
||||
password_hash=password_hash,
|
||||
)
|
||||
try:
|
||||
with sqlmodel.Session(engine) as session:
|
||||
|
@ -19,7 +19,7 @@ def get_master_pass(
|
||||
result = session.exec(statement).first()
|
||||
if result is None:
|
||||
return
|
||||
return (result.salt, result.passwd)
|
||||
return (result.salt, result.password_hash)
|
||||
|
||||
|
||||
def get_accounts(engine: Engine, user_id: int) -> list[str]:
|
||||
@ -43,7 +43,7 @@ def get_all_accounts(
|
||||
with sqlmodel.Session(engine) as session:
|
||||
result = session.exec(statement)
|
||||
yield from (
|
||||
(account.name, account.salt, account.enc_login, account.enc_pass)
|
||||
(account.name, account.salt, account.enc_login, account.enc_password)
|
||||
for account in result
|
||||
)
|
||||
|
||||
@ -61,4 +61,4 @@ def get_account_info(
|
||||
result = session.exec(statement).first()
|
||||
if result is None:
|
||||
return
|
||||
return (result.salt, result.enc_login, result.enc_pass)
|
||||
return (result.salt, result.enc_login, result.enc_password)
|
||||
|
@ -10,7 +10,7 @@ class MasterPass(sqlmodel.SQLModel, table=True):
|
||||
salt: bytes = sqlmodel.Field(
|
||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
||||
)
|
||||
passwd: bytes = sqlmodel.Field(
|
||||
password_hash: bytes = sqlmodel.Field(
|
||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(128), nullable=False)
|
||||
)
|
||||
|
||||
@ -27,6 +27,6 @@ class Account(sqlmodel.SQLModel, table=True):
|
||||
enc_login: bytes = sqlmodel.Field(
|
||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
||||
)
|
||||
enc_pass: bytes = sqlmodel.Field(
|
||||
enc_password: bytes = sqlmodel.Field(
|
||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
||||
)
|
||||
|
Reference in New Issue
Block a user