Renamed src/database into src/db
This commit is contained in:
22
src/db/change.py
Normal file
22
src/db/change.py
Normal file
@ -0,0 +1,22 @@
|
||||
import sqlmodel
|
||||
from sqlalchemy.future import Engine
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
def change_master_pass(
|
||||
engine: Engine,
|
||||
master_password: models.MasterPass,
|
||||
) -> None:
|
||||
"""Changes master password and salt in the database"""
|
||||
statement = (
|
||||
sqlmodel.update(models.MasterPass)
|
||||
.where(models.MasterPass.user_id == master_password.user_id)
|
||||
.values(
|
||||
salt=master_password.salt,
|
||||
password_hash=master_password.password_hash,
|
||||
)
|
||||
)
|
||||
with sqlmodel.Session(engine) as session:
|
||||
session.exec(statement)
|
||||
session.commit()
|
Reference in New Issue
Block a user