1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 14:19:59 +00:00

Weed out last few hardcoded urls

This commit is contained in:
TheAMM 2017-08-05 22:42:21 +03:00
parent e728ca1818
commit 7a04d64f9c
2 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -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