mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
108536490: Adding the login manager and csrf token.
Still need to figure out how to override the load_user method, currently it is not working.
This commit is contained in:
@@ -43,6 +43,30 @@ class Users(db.Model):
|
||||
|
||||
return filter_null_value_fields(serialized)
|
||||
|
||||
def is_authenticated(self):
|
||||
return True
|
||||
|
||||
def is_active(self):
|
||||
return True
|
||||
|
||||
def is_locked(self):
|
||||
if self.failed_login_count <= current_app.config['MAX_FAILED_LOGIN_COUNT']:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def is_anonymous(self):
|
||||
return False
|
||||
|
||||
def get_id(self):
|
||||
return self.id
|
||||
|
||||
@staticmethod
|
||||
def load_user(user_id):
|
||||
user = Users.query.filter_by(id=user_id).first()
|
||||
if user.is_active():
|
||||
return user
|
||||
|
||||
|
||||
def filter_null_value_fields(obj):
|
||||
return dict(
|
||||
|
||||
Reference in New Issue
Block a user