def login(): logging.info('Started login') message = None global notifications if notifications: message = notifications notifications = None if 'uid' in session: logging.info(session) return redirect(url_for('show_feed')) if request.method == 'POST': result = Users.loginForm(db, request.form) if not result: notifications = {'message': 'Logged in', 'type': 'success'} #XSS Protection response = make_response( render_template('user-feed.html', message=message)) response.headers['X-XSS-Protection'] = '1; mode=block' return response else: message = {'message': 'Failed to log in', 'type': 'error'} response = make_response( render_template('login.html', message=message)) response.headers['X-XSS-Protection'] = '1; mode=block' return response response = make_response(render_template('login.html', message=message)) response.headers['X-XSS-Protection'] = '1; mode=block' return response
def login(): message = None global notifications if notifications: message = notifications notifications = None if 'username' in session: return redirect(url_for('index')) if request.method == 'POST': result = Users.loginForm(db, request.form) if not result: notifications = {'message': 'Logged in', 'type': 'success'} return redirect(url_for('index')) else: message = {'message': 'Failed to log in', 'type': 'error'} return render_template('login.html', message=message) return render_template('login.html', message=message)
def login(): logging.info('Started login') message = None global notifications if notifications: message = notifications notifications = None if 'uid' in session: logging.info(session) return redirect(url_for('profile')) print("Inside login") if request.method == 'POST': result = Users.loginForm(db, request.form) print(result) if not result: notifications = {'message': 'Logged in', 'type': 'success'} return redirect(url_for('profile')) else: message = {'message': 'Failed to log in', 'type': 'error'} return render_template('login.html', message=message) return render_template('login.html', message=message)