fix main.index redirect of oauth functions

This commit is contained in:
deflax 2024-04-06 17:15:05 +03:00
parent c05e2f77f3
commit 0e6236ad1d

View file

@ -16,7 +16,7 @@ import pyqrcode
@auth.route('/authorize/<provider>')
def oauth2_authorize(provider):
if not current_user.is_anonymous:
return redirect(url_for('index'))
return redirect(url_for('main.index'))
provider_data = current_app.config['OAUTH2_PROVIDERS'].get(provider)
if provider_data is None:
@ -41,7 +41,7 @@ def oauth2_authorize(provider):
@auth.route('/callback/<provider>')
def oauth2_callback(provider):
if not current_user.is_anonymous:
return redirect(url_for('index'))
return redirect(url_for('main.index'))
provider_data = current_app.config['OAUTH2_PROVIDERS'].get(provider)
if provider_data is None:
@ -52,7 +52,7 @@ def oauth2_callback(provider):
for k, v in request.args.items():
if k.startswith('error'):
flash(f'{k}: {v}')
return redirect(url_for('index'))
return redirect(url_for('main.index'))
# make sure that the state parameter matches the one we created in the
# authorization request