mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
108536490: Implement User.is_active()
If the state of the user is inactive the user.is_active() returns false.
This commit is contained in:
@@ -22,6 +22,8 @@ def process_sign_in():
|
||||
user = users_dao.get_user_by_email(form.email_address.data)
|
||||
if user.is_locked():
|
||||
return jsonify(locked_out=True), 401
|
||||
if not user.is_active():
|
||||
return jsonify(active_user=False), 401
|
||||
if user is None:
|
||||
return jsonify(authorization=False), 401
|
||||
if checkpw(form.password.data, user.password):
|
||||
|
||||
@@ -47,7 +47,10 @@ class User(db.Model):
|
||||
return True
|
||||
|
||||
def is_active(self):
|
||||
return True
|
||||
if self.state == 'inactive':
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def is_anonymous(self):
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user