Merge branch 'implement_delete_account' into 'development'
Implement delete account See merge request !11
This commit is contained in:
commit
2176579baa
|
@ -28,7 +28,8 @@ from rollerverbrauch.forms import \
|
||||||
CreatePitstopForm, \
|
CreatePitstopForm, \
|
||||||
EditVehicleForm, \
|
EditVehicleForm, \
|
||||||
DeleteVehicleForm, \
|
DeleteVehicleForm, \
|
||||||
SelectVehicleForm
|
SelectVehicleForm, \
|
||||||
|
DeleteAccountForm
|
||||||
|
|
||||||
from rollerverbrauch.entities import \
|
from rollerverbrauch.entities import \
|
||||||
User, \
|
User, \
|
||||||
|
@ -237,3 +238,16 @@ def get_statistics():
|
||||||
for vehicle in current_user.vehicles:
|
for vehicle in current_user.vehicles:
|
||||||
stats.append(tools.VehicleStats(vehicle))
|
stats.append(tools.VehicleStats(vehicle))
|
||||||
return render_template('statistics.html', data=stats)
|
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():
|
||||||
|
user_datastore.delete_user(current_user)
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
return render_template('deleteAccountForm.html', form=form)
|
||||||
|
|
|
@ -44,3 +44,7 @@ class EditVehicleForm(Form):
|
||||||
|
|
||||||
class DeleteVehicleForm(Form):
|
class DeleteVehicleForm(Form):
|
||||||
submit = SubmitField(label='Do it!')
|
submit = SubmitField(label='Do it!')
|
||||||
|
|
||||||
|
|
||||||
|
class DeleteAccountForm(Form):
|
||||||
|
submit = SubmitField(label='Really delete my account!')
|
||||||
|
|
|
@ -55,4 +55,12 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Account</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<a href='{{ url_for('delete_account') }}' class="btn btn-primary " role="button">
|
||||||
|
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -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