From 8c38fe5b56f3b9d8ee5be06467d66ea5560069ff Mon Sep 17 00:00:00 2001 From: Son NK Date: Mon, 22 Jul 2019 19:55:52 +0200 Subject: [PATCH] set custom=True when user creates a custom alias --- app/dashboard/views/custom_alias.py | 2 +- app/oauth/views/authorize.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/dashboard/views/custom_alias.py b/app/dashboard/views/custom_alias.py index d516c4b7..e575cef0 100644 --- a/app/dashboard/views/custom_alias.py +++ b/app/dashboard/views/custom_alias.py @@ -41,7 +41,7 @@ def custom_alias(): else: # create the new alias LOG.d("create custom alias %s for user %s", full_email, current_user) - GenEmail.create(email=full_email, user_id=current_user.id) + GenEmail.create(email=full_email, user_id=current_user.id, custom=True) db.session.commit() flash(f"Email alias {full_email} has been created", "success") diff --git a/app/oauth/views/authorize.py b/app/oauth/views/authorize.py index f02fad25..516d061e 100644 --- a/app/oauth/views/authorize.py +++ b/app/oauth/views/authorize.py @@ -123,7 +123,9 @@ def authorize(): email = f"{convert_to_id(custom_email_prefix)}.{email_suffix}@{EMAIL_DOMAIN}" LOG.d("create custom email alias %s for user %s", email, current_user) - gen_email = GenEmail.create(email=email, user_id=current_user.id) + gen_email = GenEmail.create( + email=email, user_id=current_user.id, custom=True + ) db.session.flush() else: # user picks an email from suggestion if chosen_email != current_user.email: