diff --git a/app/api/views/alias_options.py b/app/api/views/alias_options.py index acd52299..07b21c09 100644 --- a/app/api/views/alias_options.py +++ b/app/api/views/alias_options.py @@ -31,7 +31,7 @@ def options(): ret = { "existing": [ge.email for ge in GenEmail.query.filter_by(user_id=user.id)], - "can_create_custom": user.can_create_new_custom_alias(), + "can_create_custom": user.can_create_new_alias(), } # recommendation alias if exist diff --git a/app/api/views/new_custom_alias.py b/app/api/views/new_custom_alias.py index 3c242812..b2ce5387 100644 --- a/app/api/views/new_custom_alias.py +++ b/app/api/views/new_custom_alias.py @@ -26,7 +26,7 @@ def new_custom_alias(): """ user = g.user - if not user.can_create_new_custom_alias(): + if not user.can_create_new_alias(): LOG.d("user %s cannot create custom alias", user) return ( jsonify( diff --git a/app/dashboard/views/custom_alias.py b/app/dashboard/views/custom_alias.py index c0819f50..90d34cbc 100644 --- a/app/dashboard/views/custom_alias.py +++ b/app/dashboard/views/custom_alias.py @@ -13,7 +13,7 @@ from app.utils import convert_to_id, random_word @login_required def custom_alias(): # check if user has the right to create custom alias - if not current_user.can_create_new_custom_alias(): + if not current_user.can_create_new_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 0a23a9ce..e2df2e3a 100644 --- a/app/dashboard/views/index.py +++ b/app/dashboard/views/index.py @@ -50,7 +50,7 @@ def index(): ) elif request.form.get("form-name") == "create-custom-email": - if current_user.can_create_new_custom_alias(): + if current_user.can_create_new_alias(): return redirect(url_for("dashboard.custom_alias")) else: flash( diff --git a/app/models.py b/app/models.py index a693063f..7dc438d7 100644 --- a/app/models.py +++ b/app/models.py @@ -130,7 +130,7 @@ class User(db.Model, ModelMixin, UserMixin): return False - def can_create_new_custom_alias(self): + def can_create_new_alias(self): if self.is_premium(): return True @@ -160,7 +160,7 @@ class User(db.Model, ModelMixin, UserMixin): website_name = convert_to_id(website_name) all_gen_emails = [ge.email for ge in GenEmail.filter_by(user_id=self.id)] - if self.can_create_new_custom_alias(): + if self.can_create_new_alias(): suggested_gen_email = GenEmail.create_custom_alias( self.id, prefix=website_name ).email diff --git a/app/oauth/templates/oauth/authorize.html b/app/oauth/templates/oauth/authorize.html index 267822ab..c1143b1b 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_new_custom_alias() %} + {% if current_user.can_create_new_alias() %}
OR