add advanced app setting: delete app
This commit is contained in:
parent
1dd7a761fa
commit
a44ce732be
|
@ -0,0 +1,11 @@
|
|||
{% extends 'developer/client_details/base.html' %}
|
||||
|
||||
{% set client_details_page = "advanced" %}
|
||||
|
||||
{% block client_details_content %}
|
||||
<form method="post">
|
||||
{{ form.csrf_token }}
|
||||
<h3>Please note that this operation is not reversible!</h3>
|
||||
<button type="submit" class="btn btn-danger">Delete App</button>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -29,6 +29,11 @@
|
|||
<span class="icon mr-3"><i class="fe fe-shield"></i></span>OAuth Endpoints
|
||||
</a>
|
||||
|
||||
<a href="{{ url_for('developer.client_detail_advanced', client_id=client.id) }}"
|
||||
class="list-group-item list-group-item-action {{ 'active' if client_details_page == 'advanced' }}">
|
||||
<span class="icon mr-3"><i class="fe fe-alert-octagon"></i></span>Advanced Setting
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
|
|
|
@ -119,3 +119,35 @@ def client_detail_oauth_endpoint(client_id):
|
|||
return render_template(
|
||||
"developer/client_details/oauth_endpoint.html", client=client
|
||||
)
|
||||
|
||||
|
||||
class AdvancedForm(FlaskForm):
|
||||
pass
|
||||
|
||||
|
||||
@developer_bp.route("/clients/<client_id>/advanced", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def client_detail_advanced(client_id):
|
||||
form = AdvancedForm()
|
||||
client = Client.get(client_id)
|
||||
if not client:
|
||||
flash("no such app", "warning")
|
||||
return redirect(url_for("developer.index"))
|
||||
|
||||
if client.user_id != current_user.id:
|
||||
flash("you cannot see this app", "warning")
|
||||
return redirect(url_for("developer.index"))
|
||||
|
||||
if form.validate_on_submit():
|
||||
# delete client
|
||||
client_name = client.name
|
||||
Client.delete(client.id)
|
||||
db.session.commit()
|
||||
LOG.d("Remove client %s", client)
|
||||
flash(f"{client_name} has been deleted successfully", "success")
|
||||
|
||||
return redirect(url_for("developer.index"))
|
||||
|
||||
return render_template(
|
||||
"developer/client_details/advanced.html", form=form, client=client
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue