diff options
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r-- | pyaggr3g470r/models.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py index 5139c1d4..3e3f76d4 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -28,7 +28,7 @@ __license__ = "GPLv3" import re import json -import random, base64, hashlib +import random, hashlib from datetime import datetime from sqlalchemy import asc, desc from werkzeug import generate_password_hash, check_password_hash @@ -45,8 +45,10 @@ class User(db.Model, UserMixin): email = db.Column(db.String(254), index = True, unique = True) pwdhash = db.Column(db.String()) roles = db.relationship('Role', backref = 'user', lazy = 'dynamic') - activation_key = db.Column(db.String(86), default = base64.b64encode(hashlib.sha512( str(random.getrandbits(256)) ).digest(), - random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])).rstrip('==')) + activation_key = db.Column(db.String(86), default = + hashlib.sha512( + str(random.getrandbits(256)).encode("utf-8") + ).hexdigest()) date_created = db.Column(db.DateTime(), default=datetime.now) last_seen = db.Column(db.DateTime(), default=datetime.now) feeds = db.relationship('Feed', backref = 'subscriber', lazy = 'dynamic', cascade='all,delete-orphan') |