mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
Update html
This commit is contained in:
parent
bfb1ae6371
commit
0c896100a4
2 changed files with 12 additions and 4 deletions
|
@ -51,6 +51,15 @@ def email_validator():
|
|||
return _check
|
||||
|
||||
|
||||
def user_can_create_contacts(user: User) -> bool:
|
||||
if user.is_premium():
|
||||
return True
|
||||
return (
|
||||
config.DISABLE_CREATE_CONTACTS_FOR_FREE_USERS
|
||||
and user.flags & User.FLAG_FREE_DISABLE_CREATE_ALIAS > 0
|
||||
)
|
||||
|
||||
|
||||
def create_contact(user: User, alias: Alias, contact_address: str) -> Contact:
|
||||
"""
|
||||
Create a contact for a user. Can be restricted for new free users by enabling DISABLE_CREATE_CONTACTS_FOR_FREE_USERS.
|
||||
|
@ -74,9 +83,7 @@ def create_contact(user: User, alias: Alias, contact_address: str) -> Contact:
|
|||
if contact:
|
||||
raise ErrContactAlreadyExists(contact)
|
||||
|
||||
if config.DISABLE_CREATE_CONTACTS_FOR_FREE_USERS and (
|
||||
not user.is_premium() and user.flags & User.FLAG_FREE_DISABLE_CREATE_ALIAS > 0
|
||||
):
|
||||
if not user_can_create_contacts(user):
|
||||
raise ErrContactErrorUpgradeNeeded()
|
||||
|
||||
contact = Contact.create(
|
||||
|
@ -312,4 +319,5 @@ def alias_contact_manager(alias_id):
|
|||
last_page=last_page,
|
||||
query=query,
|
||||
nb_contact=nb_contact,
|
||||
can_create_contacts=user_can_create_contacts(current_user),
|
||||
)
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<div class="small-text">
|
||||
Where do you want to send the email?
|
||||
</div>
|
||||
{% if alias.user.is_premium() %}
|
||||
{% if can_create_contacts %}
|
||||
<button class="btn btn-primary mt-2">Create reverse-alias</button>
|
||||
{% else %}
|
||||
<button disabled title='Upgrade to premium to create reverse-aliases' class="btn btn-primary mt-2">Create reverse-alias</button>
|
||||
|
|
Loading…
Reference in a new issue