mirror of
https://github.com/simple-login/app.git
synced 2024-11-10 17:35:27 +08:00
add remove button on custom domain name
This commit is contained in:
parent
c28872288b
commit
bcb2657de3
2 changed files with 18 additions and 7 deletions
|
@ -72,7 +72,10 @@
|
|||
name="alias-name"
|
||||
placeholder="Alias name">
|
||||
</div>
|
||||
<button class="btn btn-primary">Save</button>
|
||||
<button class="btn btn-primary" name="action" value="save">Save</button>
|
||||
{% if custom_domain.name %}
|
||||
<button class="btn btn-danger float-right" name="action" value="remove">Remove</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -154,12 +154,20 @@ def domain_detail(custom_domain_id):
|
|||
url_for("dashboard.domain_detail", custom_domain_id=custom_domain.id)
|
||||
)
|
||||
elif request.form.get("form-name") == "set-name":
|
||||
custom_domain.name = request.form.get("alias-name").replace("\n", "")
|
||||
db.session.commit()
|
||||
flash(
|
||||
f"Default alias name for Domain {custom_domain.domain} has been set",
|
||||
"success",
|
||||
)
|
||||
if request.form.get("action") == "save":
|
||||
custom_domain.name = request.form.get("alias-name").replace("\n", "")
|
||||
db.session.commit()
|
||||
flash(
|
||||
f"Default alias name for Domain {custom_domain.domain} has been set",
|
||||
"success",
|
||||
)
|
||||
else:
|
||||
custom_domain.name = None
|
||||
db.session.commit()
|
||||
flash(
|
||||
f"Default alias name for Domain {custom_domain.domain} has been removed",
|
||||
"info",
|
||||
)
|
||||
|
||||
return redirect(
|
||||
url_for("dashboard.domain_detail", custom_domain_id=custom_domain.id)
|
||||
|
|
Loading…
Reference in a new issue