aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-12 21:59:05 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-12 21:59:05 +0200
commit116c76091691c972cb2e108482508052ffc4a065 (patch)
tree0e8a19bf9c2327d5e56f2537619d84adb4a2c03f
parentSimplification of the login forms. (diff)
downloadnewspipe-116c76091691c972cb2e108482508052ffc4a065.tar.gz
newspipe-116c76091691c972cb2e108482508052ffc4a065.tar.bz2
newspipe-116c76091691c972cb2e108482508052ffc4a065.zip
Added activation key for users.
-rw-r--r--pyaggr3g470r/models.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py
index 15973d80..ced7e549 100644
--- a/pyaggr3g470r/models.py
+++ b/pyaggr3g470r/models.py
@@ -28,6 +28,7 @@ __license__ = "GPLv3"
import re
import json
+import random, base64, hashlib
from datetime import datetime
from sqlalchemy import asc, desc
from werkzeug import generate_password_hash, check_password_hash
@@ -44,6 +45,8 @@ 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('=='))
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