diff --git a/app/dashboard/views/custom_alias.py b/app/dashboard/views/custom_alias.py index b04d34db..a833d297 100644 --- a/app/dashboard/views/custom_alias.py +++ b/app/dashboard/views/custom_alias.py @@ -77,7 +77,6 @@ def custom_alias(): full_email, custom_domain.domain, ) - # todo: add custom_id to GenEmail gen_email = GenEmail.create( email=full_email, user_id=current_user.id, diff --git a/app/dashboard/views/index.py b/app/dashboard/views/index.py index af115aa4..0a23a9ce 100644 --- a/app/dashboard/views/index.py +++ b/app/dashboard/views/index.py @@ -49,22 +49,6 @@ def index(): "success", ) - elif request.form.get("form-name") == "create-random-email": - can_create_new_random_alias = current_user.can_create_new_random_alias() - - if can_create_new_random_alias: - gen_email = GenEmail.create_new_gen_email(user_id=current_user.id) - db.session.commit() - - LOG.d("generate new email %s for user %s", gen_email, current_user) - flash(f"Email {gen_email.email} has been created", "success") - session[HIGHLIGHT_GEN_EMAIL_ID] = gen_email.id - else: - flash( - f"You need to upgrade your plan to create new random alias.", - "warning", - ) - elif request.form.get("form-name") == "create-custom-email": if current_user.can_create_new_custom_alias(): return redirect(url_for("dashboard.custom_alias")) diff --git a/app/oauth/views/authorize.py b/app/oauth/views/authorize.py index d583dc18..42d8a706 100644 --- a/app/oauth/views/authorize.py +++ b/app/oauth/views/authorize.py @@ -272,21 +272,6 @@ def authorize(): return redirect(construct_url(redirect_uri, redirect_args, fragment)) -def create_or_choose_gen_email(user) -> GenEmail: - can_create_new_random_alias = user.can_create_new_random_alias() - - if can_create_new_random_alias: - gen_email = GenEmail.create_new_gen_email(user_id=user.id) - db.session.flush() - LOG.debug("generate email %s for user %s", gen_email.email, user) - else: # need to reuse one of the gen emails created - LOG.d("pick a random email for gen emails for user %s", current_user) - gen_emails = GenEmail.filter_by(user_id=current_user.id).all() - gen_email = random.choice(gen_emails) - - return gen_email - - def construct_url(url, args: Dict[str, str], fragment: bool = False): for i, (k, v) in enumerate(args.items()): # make sure to escape v