diff --git a/app/dashboard/views/custom_alias.py b/app/dashboard/views/custom_alias.py index fec1be7a..d1272bbc 100644 --- a/app/dashboard/views/custom_alias.py +++ b/app/dashboard/views/custom_alias.py @@ -14,7 +14,7 @@ from app.utils import convert_to_id, random_string @login_required def custom_alias(): # check if user has the right to create custom alias - if not current_user.can_create_custom_email(): + if not current_user.can_create_new_custom_alias(): # notify admin LOG.error("user %s tries to create custom alias", current_user) flash("ony premium user can choose custom alias", "warning") diff --git a/app/dashboard/views/index.py b/app/dashboard/views/index.py index 56503804..02365a64 100644 --- a/app/dashboard/views/index.py +++ b/app/dashboard/views/index.py @@ -50,9 +50,9 @@ def index(): ) elif request.form.get("form-name") == "create-random-email": - can_create_new_email = current_user.can_create_new_email() + can_create_new_random_alias = current_user.can_create_new_random_alias() - if can_create_new_email: + if can_create_new_random_alias: gen_email = GenEmail.create_new_gen_email(user_id=current_user.id) db.session.commit() @@ -66,7 +66,7 @@ def index(): ) elif request.form.get("form-name") == "create-custom-email": - if current_user.can_create_custom_email(): + if current_user.can_create_new_custom_alias(): return redirect(url_for("dashboard.custom_alias")) else: flash( diff --git a/app/models.py b/app/models.py index b4445001..6cc06053 100644 --- a/app/models.py +++ b/app/models.py @@ -134,7 +134,7 @@ class User(db.Model, ModelMixin, UserMixin): return False - def can_create_custom_email(self): + def can_create_new_custom_alias(self): if self.is_premium(): return True @@ -143,7 +143,7 @@ class User(db.Model, ModelMixin, UserMixin): < MAX_NB_EMAIL_FREE_PLAN ) - def can_create_new_email(self): + def can_create_new_random_alias(self): if self.is_premium(): return True else: @@ -171,7 +171,7 @@ class User(db.Model, ModelMixin, UserMixin): def suggested_emails(self) -> (str, [str]): """return suggested email and other email choices """ all_gen_emails = [ge.email for ge in GenEmail.filter_by(user_id=self.id)] - if self.can_create_new_email(): + if self.can_create_new_random_alias(): # create a new email suggested_gen_email = generate_email() else: diff --git a/app/oauth/templates/oauth/authorize.html b/app/oauth/templates/oauth/authorize.html index b44636bb..259ef663 100644 --- a/app/oauth/templates/oauth/authorize.html +++ b/app/oauth/templates/oauth/authorize.html @@ -90,7 +90,7 @@ {% endfor %} - {% if current_user.can_create_custom_email() %} + {% if current_user.can_create_new_custom_alias() %}