mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 23:16:00 +08:00
Merge pull request #935 from simple-login/disable-user-cannot-create-new-alias
make sure disabled user can't create new alias
This commit is contained in:
commit
69d1875be1
|
@ -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
|
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*
|
- 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():
|
if self.lifetime_or_active_subscription():
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -250,3 +250,11 @@ def test_EnumE():
|
||||||
|
|
||||||
assert E.get_value("A") == 100
|
assert E.get_value("A") == 100
|
||||||
assert E.get_value("Not existent") is None
|
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