Merge branch 'sunday'
This commit is contained in:
commit
87bc37f6c8
12 changed files with 75 additions and 35 deletions
|
@ -103,7 +103,7 @@ def hash_password(password, salt=None):
|
|||
def is_create_user_allowed():
|
||||
return True
|
||||
|
||||
def create_user(username, password, email):
|
||||
def create_user(username, password, email, auto_verify=False):
|
||||
""" Creates a regular user, if allowed. """
|
||||
if not validate_password(password):
|
||||
raise InvalidPasswordException(INVALID_PASSWORD_MESSAGE)
|
||||
|
@ -112,11 +112,8 @@ def create_user(username, password, email):
|
|||
raise TooManyUsersException()
|
||||
|
||||
created = _create_user(username, email)
|
||||
|
||||
# Store the password hash
|
||||
pw_hash = hash_password(password)
|
||||
created.password_hash = pw_hash
|
||||
|
||||
created.password_hash = hash_password(password)
|
||||
created.verified = auto_verify
|
||||
created.save()
|
||||
|
||||
return created
|
||||
|
@ -353,12 +350,11 @@ def remove_team(org_name, team_name, removed_by_username):
|
|||
team.delete_instance(recursive=True, delete_nullable=True)
|
||||
|
||||
|
||||
def add_or_invite_to_team(inviter, team, user=None, email=None):
|
||||
def add_or_invite_to_team(inviter, team, user=None, email=None, requires_invite=True):
|
||||
# If the user is a member of the organization, then we simply add the
|
||||
# user directly to the team. Otherwise, an invite is created for the user/email.
|
||||
# We return None if the user was directly added and the invite object if the user was invited.
|
||||
requires_invite = True
|
||||
if user:
|
||||
if user and requires_invite:
|
||||
orgname = team.organization.username
|
||||
|
||||
# If the user is part of the organization (or a robot), then no invite is required.
|
||||
|
@ -852,9 +848,9 @@ def change_invoice_email(user, invoice_email):
|
|||
user.save()
|
||||
|
||||
|
||||
def update_email(user, new_email):
|
||||
def update_email(user, new_email, auto_verify=False):
|
||||
user.email = new_email
|
||||
user.verified = False
|
||||
user.verified = auto_verify
|
||||
user.save()
|
||||
|
||||
|
||||
|
|
Reference in a new issue