diff --git a/app/models.py b/app/models.py index 5e750fe..b917da3 100644 --- a/app/models.py +++ b/app/models.py @@ -36,14 +36,14 @@ class User(db.Model): full_name = db.Column(db.String, nullable=True) only_doc_id = db.Column(db.Integer, nullable=True) - def __init__(self, login, password, workfactor=None): + def __init__(self, login, password): if login is None: login = 'guest' self.name = login if password is None: self.disable_password() else: - self.set_password(password, workfactor=workfactor) + self.set_password(password) def is_active(self): """ @@ -74,14 +74,12 @@ def is_admin(self): def generate(fake): username = fake.user_name() password = fake.password() - user = User(username, password, workfactor=4) + user = User(username, password) return user - def set_password(self, clear, workfactor): - if workfactor is None: - workfactor = current_app.config['BCRYPT_WORKFACTOR'] + def set_password(self, clear): bcrypt = Bcrypt(current_app) - self.password = bcrypt.generate_password_hash(clear.encode('utf-8'), workfactor) + self.password = bcrypt.generate_password_hash(clear.encode('utf-8')) def disable_password(self): self.password = '!' diff --git a/conf/common.py b/conf/common.py index cea5a9a..5b9a39f 100644 --- a/conf/common.py +++ b/conf/common.py @@ -1,3 +1,3 @@ PROPAGATE_EXCEPTIONS = True X_PDFJS_VERSION = '1.0.473' -BCRYPT_WORKFACTOR = 12 +BCRYPT_LOG_ROUNDS = 12 diff --git a/conf/testing.py b/conf/testing.py index fa3c992..c157afd 100644 --- a/conf/testing.py +++ b/conf/testing.py @@ -1,4 +1,4 @@ SQLALCHEMY_DATABASE_URI = 'sqlite://' CSRF_ENABLED = False WTF_CSRF_ENABLED = False -BCRYPT_WORKFACTOR = 4 +BCRYPT_LOG_ROUNDS = 4