Rename hash.
This commit is contained in:
parent
ca023114fa
commit
9d6286314d
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user