108536490: Implement User.is_active()

If the state of the user is inactive the user.is_active() returns false.
This commit is contained in:
Rebecca Law
2015-11-30 16:44:59 +00:00
parent 3b27db98ff
commit edfc1d6efc
4 changed files with 38 additions and 1 deletions

View File

@@ -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):

View File

@@ -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