redirect to settings if user.setup is false

This commit is contained in:
deflax 2024-04-10 18:39:50 +03:00
parent 50694fe490
commit da626df763

View file

@ -24,7 +24,7 @@ def before_request():
#print('request for {} from {}#{}'.format(request.endpoint, current_user.email, current_user.id)) #print('request for {} from {}#{}'.format(request.endpoint, current_user.email, current_user.id))
if not current_user.confirmed and request.endpoint[:5] != 'auth.' and request.endpoint != 'static': if not current_user.confirmed and request.endpoint[:5] != 'auth.' and request.endpoint != 'static':
return redirect(url_for('auth.unconfirmed')) return redirect(url_for('auth.unconfirmed'))
if not current_user.setup and request.endpoint[:5] != 'auth.' and request.endpoint != 'static': if not current_user.setup and request.endpoint[:5] != 'auth.' and request.endpoint != 'static' and request.endpoint[:16] != 'settings.profile':
return redirect(url_for('settings.profile')) return redirect(url_for('settings.profile'))
@auth.route('/unconfirmed') @auth.route('/unconfirmed')
@ -162,7 +162,8 @@ def oauth2_callback(provider):
# log the user in # log the user in
login_user(user) login_user(user)
return redirect(url_for('settings.profile')) flash('Last Login: {}'.format(user.last_seen.strftime("%a %d %B %Y %H:%M")))
return redirect(request.args.get('next') or url_for('panel.dashboard'))
@auth.route('/login', methods=['GET', 'POST']) @auth.route('/login', methods=['GET', 'POST'])
def login(): def login():