aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/models.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-10-01 08:00:43 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-10-01 08:00:43 +0200
commit639dffb7d27cc49684a6cb2a8ad57b936b1e01dc (patch)
tree1a11bc1ea366bb9eb2df2af82e3e394e4bfcbb04 /pyaggr3g470r/models.py
parentRelease 5.6.6. (diff)
downloadnewspipe-639dffb7d27cc49684a6cb2a8ad57b936b1e01dc.tar.gz
newspipe-639dffb7d27cc49684a6cb2a8ad57b936b1e01dc.tar.bz2
newspipe-639dffb7d27cc49684a6cb2a8ad57b936b1e01dc.zip
Python 3 support
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r--pyaggr3g470r/models.py8
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')
bgstack15