mirror of
https://github.com/simple-login/app.git
synced 2024-11-17 17:35:20 +01:00
Fix custom domain has been added before
This commit is contained in:
parent
5d25310105
commit
ee3c75244e
1 changed files with 18 additions and 12 deletions
|
@ -31,19 +31,25 @@ def custom_domain():
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
if request.form.get("form-name") == "create":
|
if request.form.get("form-name") == "create":
|
||||||
if new_custom_domain_form.validate():
|
if new_custom_domain_form.validate():
|
||||||
new_custom_domain = CustomDomain.create(
|
new_domain = new_custom_domain_form.domain.data
|
||||||
domain=new_custom_domain_form.domain.data, user_id=current_user.id
|
if CustomDomain.get_by(domain=new_domain):
|
||||||
)
|
flash(f"{new_domain} already added", "warning")
|
||||||
db.session.commit()
|
else:
|
||||||
|
new_custom_domain = CustomDomain.create(
|
||||||
flash(f"New domain {new_custom_domain.domain} is created", "success")
|
domain=new_domain, user_id=current_user.id
|
||||||
|
)
|
||||||
return redirect(
|
db.session.commit()
|
||||||
url_for(
|
|
||||||
"dashboard.domain_detail_dns",
|
flash(
|
||||||
custom_domain_id=new_custom_domain.id,
|
f"New domain {new_custom_domain.domain} is created", "success"
|
||||||
|
)
|
||||||
|
|
||||||
|
return redirect(
|
||||||
|
url_for(
|
||||||
|
"dashboard.domain_detail_dns",
|
||||||
|
custom_domain_id=new_custom_domain.id,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"dashboard/custom_domain.html",
|
"dashboard/custom_domain.html",
|
||||||
|
|
Loading…
Reference in a new issue