23 lines
593 B
Python
23 lines
593 B
Python
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()
|