aurweb.models.user: Remove session.commit() from construction

We don't want to do this on construction. We only want to do this
when we want to actually add the user to the database (or modify it).

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-05-31 22:45:30 -07:00
parent f8a6049de2
commit 621e459dfb

View file

@ -51,11 +51,9 @@ class User:
self.update_password(passwd) self.update_password(passwd)
def update_password(self, password, salt_rounds=12): def update_password(self, password, salt_rounds=12):
from aurweb.db import session
self.Passwd = bcrypt.hashpw( self.Passwd = bcrypt.hashpw(
password.encode(), password.encode(),
bcrypt.gensalt(rounds=salt_rounds)).decode() bcrypt.gensalt(rounds=salt_rounds)).decode()
session.commit()
@staticmethod @staticmethod
def minimum_passwd_length(): def minimum_passwd_length():