Rename hash.

This commit is contained in:
Alexis Lahouze 2015-11-27 11:36:04 +01:00
parent ca023114fa
commit 9d6286314d

View File

@ -15,7 +15,7 @@
along with Accountant. If not, see <http://www.gnu.org/licenses/>. along with Accountant. If not, see <http://www.gnu.org/licenses/>.
""" """
# vim: set tw=80 ts=4 sw=4 sts=4: # vim: set tw=80 ts=4 sw=4 sts=4:
from passlib.hash import sha256_crypt from passlib.hash import sha256_crypt as crypt
from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer, from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer,
BadSignature, SignatureExpired) BadSignature, SignatureExpired)
@ -45,10 +45,10 @@ class User(UserMixin, db.Model):
@classmethod @classmethod
def hash_password(cls, password): def hash_password(cls, password):
return sha256_crypt.encrypt(password) return crypt.encrypt(password)
def verify_password(self, password): def verify_password(self, password):
return sha256_crypt.verify(password, self.password) return crypt.verify(password, self.password)
def generate_auth_token(self, expiration=600): def generate_auth_token(self, expiration=600):
serializer = Serializer(app.config['SECRET_KEY'], expires_in=expiration) serializer = Serializer(app.config['SECRET_KEY'], expires_in=expiration)