mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
make sure disabled user can't create new alias
This commit is contained in:
parent
f5a5a06e19
commit
eab7606f93
2 changed files with 11 additions and 0 deletions
|
@ -683,6 +683,9 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
|
|||
Whether user can create a new alias. User can't create a new alias if
|
||||
- has more than 15 aliases in the free plan, *even in the free trial*
|
||||
"""
|
||||
if self.disabled:
|
||||
return False
|
||||
|
||||
if self.lifetime_or_active_subscription():
|
||||
return True
|
||||
else:
|
||||
|
|
|
@ -250,3 +250,11 @@ def test_EnumE():
|
|||
|
||||
assert E.get_value("A") == 100
|
||||
assert E.get_value("Not existent") is None
|
||||
|
||||
|
||||
def test_can_create_new_alias_disabled_user():
|
||||
user = create_new_user()
|
||||
assert user.can_create_new_alias()
|
||||
|
||||
user.disabled = True
|
||||
assert not user.can_create_new_alias()
|
||||
|
|
Loading…
Reference in a new issue