users: Set tos_version to -1 for users who have not logged-in yet.

We now set tos_version to "-1" for imported users and the ones
created using API or using other methods like LDAP, SCIM and
management commands. This value will help us to allow users to
change email address visibility setting during first login.
This commit is contained in:
Sahil Batra
2023-05-08 12:47:57 +05:30
committed by Tim Abbott
parent f58e3d2cf6
commit 7f01b3fb63
11 changed files with 45 additions and 19 deletions

View File

@@ -1814,6 +1814,13 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings): # type
full_name = models.CharField(max_length=MAX_NAME_LENGTH)
date_joined = models.DateTimeField(default=timezone_now)
# Terms of Service version number that this user has accepted. We
# use the special value TOS_VERSION_BEFORE_FIRST_LOGIN for users
# whose account was created without direct user interaction (via
# the API or a data import), and null for users whose account is
# fully created on servers that do not have a configured ToS.
TOS_VERSION_BEFORE_FIRST_LOGIN = "-1"
tos_version = models.CharField(null=True, max_length=10)
api_key = models.CharField(max_length=API_KEY_LENGTH)