mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Use a better redirect mechanic in the proxied settings route
This commit is contained in:
parent
87798f4781
commit
a27caaa8a2
@ -8,7 +8,4 @@ from . import bp
|
|||||||
@bp.route('/settings', methods=['GET', 'POST'])
|
@bp.route('/settings', methods=['GET', 'POST'])
|
||||||
@register_breadcrumb(bp, '.', '<i class="material-icons left">settings</i>Settings')
|
@register_breadcrumb(bp, '.', '<i class="material-icons left">settings</i>Settings')
|
||||||
def settings():
|
def settings():
|
||||||
return settings_route(
|
return settings_route(current_user.id)
|
||||||
current_user.id,
|
|
||||||
redirect_location_on_post=url_for('.settings')
|
|
||||||
)
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
{% extends "settings/settings.html.j2" %}
|
{% extends "settings/settings.html.j2" %}
|
||||||
|
|
||||||
{% block admin_settings %}
|
{% block admin_settings %}
|
||||||
|
<div class="col s12"></div>
|
||||||
|
|
||||||
<div class="col s12 l4">
|
<div class="col s12 l4">
|
||||||
<h4>Administrator Settings</h4>
|
<h4>Administrator Settings</h4>
|
||||||
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
||||||
|
@ -102,6 +102,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col s12"></div>
|
||||||
|
|
||||||
<div class="col s12 l4">
|
<div class="col s12 l4">
|
||||||
<h4>General Settings</h4>
|
<h4>General Settings</h4>
|
||||||
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from flask import abort, flash, redirect, render_template, url_for
|
from flask import abort, flash, g, redirect, render_template, url_for
|
||||||
from flask_breadcrumbs import register_breadcrumb
|
from flask_breadcrumbs import register_breadcrumb
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
from app import db
|
from app import db
|
||||||
@ -17,12 +17,16 @@ from .forms import (
|
|||||||
@bp.route('/<hashid:user_id>/settings', methods=['GET', 'POST'])
|
@bp.route('/<hashid:user_id>/settings', methods=['GET', 'POST'])
|
||||||
@register_breadcrumb(bp, '.entity.settings', '<i class="material-icons left">settings</i>Settings', endpoint_arguments_constructor=user_eac)
|
@register_breadcrumb(bp, '.entity.settings', '<i class="material-icons left">settings</i>Settings', endpoint_arguments_constructor=user_eac)
|
||||||
@login_required
|
@login_required
|
||||||
def settings(user_id, redirect_location_on_post=None):
|
def settings(user_id):
|
||||||
user = User.query.get_or_404(user_id)
|
user = User.query.get_or_404(user_id)
|
||||||
if not (user == current_user or current_user.is_administrator()):
|
if not (user == current_user or current_user.is_administrator()):
|
||||||
abort(403)
|
abort(403)
|
||||||
if redirect_location_on_post is None:
|
|
||||||
redirect_location_on_post = url_for('.settings', user_id=user_id)
|
redirect_location_on_post = g.pop(
|
||||||
|
'redirect_location_on_post',
|
||||||
|
url_for('.settings', user_id=user_id)
|
||||||
|
)
|
||||||
|
|
||||||
update_account_information_form = UpdateAccountInformationForm(user)
|
update_account_information_form = UpdateAccountInformationForm(user)
|
||||||
update_profile_information_form = UpdateProfileInformationForm(user)
|
update_profile_information_form = UpdateProfileInformationForm(user)
|
||||||
update_avatar_form = UpdateAvatarForm()
|
update_avatar_form = UpdateAvatarForm()
|
||||||
|
Loading…
Reference in New Issue
Block a user