Merge branch 'index_page' into implement_delete_account
This commit is contained in:
parent
00579eb542
commit
da7c40c78b
@ -239,12 +239,15 @@ def get_statistics():
|
||||
stats.append(tools.VehicleStats(vehicle))
|
||||
return render_template('statistics.html', data=stats)
|
||||
|
||||
|
||||
@app.route('/account/delete', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def delete_account():
|
||||
form = DeleteAccountForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
return redirect(url_for('get_account_page'))
|
||||
user_datastore.delete_user(current_user)
|
||||
db.session.commit()
|
||||
return redirect(url_for('index'))
|
||||
|
||||
return render_template('deleteVehicleForm.html', form=form, vehicle=vehicle)
|
||||
return render_template('deleteAccountForm.html', form=form)
|
||||
|
@ -47,4 +47,4 @@ class DeleteVehicleForm(Form):
|
||||
|
||||
|
||||
class DeleteAccountForm(Form):
|
||||
submit = SubmitField(label='Do it!')
|
||||
submit = SubmitField(label='Really delete my account!')
|
||||
|
@ -58,7 +58,7 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Account</div>
|
||||
<div class="panel-body">
|
||||
<a href='{{ url_for('security.change_password') }}'>
|
||||
<a href='{{ url_for('delete_account') }}' class="btn btn-primary " role="button">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete
|
||||
</a>
|
||||
</div>
|
||||
|
18
app/rollerverbrauch/templates/deleteAccountForm.html
Normal file
18
app/rollerverbrauch/templates/deleteAccountForm.html
Normal file
@ -0,0 +1,18 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Delete account for '{{current_user.email}}'?</h3>
|
||||
This cannot be undone!
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user