user can set note when creating custom alias

This commit is contained in:
Son NK 2020-02-05 17:36:06 +07:00
parent d8229102a6
commit 145bed893f
2 changed files with 18 additions and 3 deletions

View file

@ -48,8 +48,20 @@
</div> </div>
</div> </div>
<div class="row col"> <div class="row mb-2">
<button class="btn btn-primary mt-1">Create</button> <div class="col">
<textarea name="note"
class="form-control"
rows="3"
placeholder="Note, can be anything to help you remember WHY you create this alias. This field is optional."></textarea>
</div>
</div>
<div class="row">
<div class="col">
<button class="btn btn-primary mt-1">Create</button>
</div>
</div> </div>
</form> </form>
</div> </div>

View file

@ -46,6 +46,7 @@ def custom_alias():
if request.method == "POST": if request.method == "POST":
alias_prefix = request.form.get("prefix") alias_prefix = request.form.get("prefix")
alias_suffix = request.form.get("suffix") alias_suffix = request.form.get("suffix")
alias_note = request.form.get("note")
if verify_prefix_suffix( if verify_prefix_suffix(
current_user, alias_prefix, alias_suffix, user_custom_domains current_user, alias_prefix, alias_suffix, user_custom_domains
@ -61,7 +62,9 @@ def custom_alias():
"warning", "warning",
) )
else: else:
gen_email = GenEmail.create(user_id=current_user.id, email=full_alias) gen_email = GenEmail.create(
user_id=current_user.id, email=full_alias, note=alias_note
)
# get the custom_domain_id if alias is created with a custom domain # get the custom_domain_id if alias is created with a custom domain
alias_domain = get_email_domain_part(full_alias) alias_domain = get_email_domain_part(full_alias)