mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-13 22:45:05 +02:00
Change ineligible to restricted on User, fix status tempplate for DAs
This commit is contained in:
parent
b6af335e03
commit
501cddebde
8 changed files with 57 additions and 37 deletions
|
@ -18,8 +18,8 @@ class User(AbstractUser):
|
|||
"""
|
||||
|
||||
# #### Constants for choice fields ####
|
||||
INELIGIBLE = "ineligible"
|
||||
STATUS_CHOICES = ((INELIGIBLE, INELIGIBLE),)
|
||||
RESTRICTED = "restricted"
|
||||
STATUS_CHOICES = ((RESTRICTED, RESTRICTED),)
|
||||
|
||||
status = models.CharField(
|
||||
max_length=10,
|
||||
|
@ -51,18 +51,16 @@ class User(AbstractUser):
|
|||
else:
|
||||
return self.username
|
||||
|
||||
def block_user(self):
|
||||
self.status = "ineligible"
|
||||
def restrict_user(self):
|
||||
self.status = self.RESTRICTED
|
||||
self.save()
|
||||
|
||||
def unblock_user(self):
|
||||
def unrestrict_user(self):
|
||||
self.status = None
|
||||
self.save()
|
||||
|
||||
def is_blocked(self):
|
||||
if self.status == "ineligible":
|
||||
return True
|
||||
return False
|
||||
def is_restricted(self):
|
||||
return self.status == self.RESTRICTED
|
||||
|
||||
def first_login(self):
|
||||
"""Callback when the user is authenticated for the very first time.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue