108536490: Implement LoginManager for the admin app.

Also added csrf error handler, will make the session unauthorized if the csrf token is invalid.
This commit is contained in:
Rebecca Law
2015-11-30 11:21:51 +00:00
parent 48b7a7dc37
commit 6f61906fd4
6 changed files with 87 additions and 59 deletions

View File

@@ -12,7 +12,7 @@ class Roles(db.Model):
role = db.Column(db.String, nullable=False, unique=True)
class Users(db.Model):
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
@@ -63,7 +63,7 @@ class Users(db.Model):
@staticmethod
def load_user(user_id):
user = Users.query.filter_by(id=user_id).first()
user = User.query.filter_by(id=user_id).first()
if user.is_active():
return user