|
|
@@ -33,6 +33,8 @@ from sqlalchemy.orm import ( |
|
|
|
from zope.sqlalchemy import ZopeTransactionExtension |
|
|
|
from jm2l.const import CurrentYear |
|
|
|
|
|
|
|
from passlib.hash import argon2 |
|
|
|
|
|
|
|
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) |
|
|
|
Base = declarative_base() |
|
|
|
|
|
|
@@ -247,7 +249,11 @@ class User(Base): |
|
|
|
return MediaPath().get_thumb('users', self.uid) |
|
|
|
|
|
|
|
def verify_password(self, password): |
|
|
|
return self.password == password |
|
|
|
if not argon2.identify(self.password): # Update existing clear-text password |
|
|
|
self.password = argon2.using(rounds=4).hash(self.password) |
|
|
|
DBSession.merge(self) |
|
|
|
|
|
|
|
return argon2.verify(password, self.password) |
|
|
|
|
|
|
|
class TiersOpt(Base): |
|
|
|
__tablename__ = 'tiers_opt' |
|
|
|