mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 09:10:00 +00:00
Weed out last few hardcoded urls
This commit is contained in:
parent
e728ca1818
commit
7a04d64f9c
|
@ -49,7 +49,7 @@ def create_app(config):
|
||||||
app.logger.error(exception)
|
app.logger.error(exception)
|
||||||
flask.flash(flask.Markup(
|
flask.flash(flask.Markup(
|
||||||
'<strong>An error occurred!</strong> Debug information has been logged.'), 'danger')
|
'<strong>An error occurred!</strong> Debug information has been logged.'), 'danger')
|
||||||
return flask.redirect('/')
|
return flask.redirect(flask.url_for('main.home'))
|
||||||
|
|
||||||
# Get git commit hash
|
# Get git commit hash
|
||||||
app.config['COMMIT_HASH'] = None
|
app.config['COMMIT_HASH'] = None
|
||||||
|
|
|
@ -93,7 +93,8 @@ def register():
|
||||||
@bp.route('/profile', methods=['GET', 'POST'])
|
@bp.route('/profile', methods=['GET', 'POST'])
|
||||||
def profile():
|
def profile():
|
||||||
if not flask.g.user:
|
if not flask.g.user:
|
||||||
return flask.redirect('/') # so we dont get stuck in infinite loop when signing out
|
# so we dont get stuck in infinite loop when signing out
|
||||||
|
return flask.redirect(flask.url_for('main.home'))
|
||||||
|
|
||||||
form = forms.ProfileForm(flask.request.form)
|
form = forms.ProfileForm(flask.request.form)
|
||||||
|
|
||||||
|
@ -130,11 +131,13 @@ def profile():
|
||||||
|
|
||||||
|
|
||||||
def redirect_url():
|
def redirect_url():
|
||||||
|
home_url = flask.url_for('main.home')
|
||||||
|
|
||||||
url = flask.request.args.get('next') or \
|
url = flask.request.args.get('next') or \
|
||||||
flask.request.referrer or \
|
flask.request.referrer or \
|
||||||
'/'
|
home_url
|
||||||
if url == flask.request.url:
|
if url == flask.request.url:
|
||||||
return '/'
|
return home_url
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue