From 116c76091691c972cb2e108482508052ffc4a065 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 12 May 2014 21:59:05 +0200 Subject: Added activation key for users. --- pyaggr3g470r/models.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pyaggr3g470r') 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') -- cgit