def authenticate(): username = request.form['username'] password = request.form['password'] password_sha = hashlib.sha256(password).hexdigest() if password_sha == user.login(username): gateway_id = user.user_gatewayid(username) # url = user.user_url(username) session['gateway_id'] = str(gateway_id) session['username'] = username info = 'Welcome ' + username print info resp = make_response(redirect(url_for('index'), code=302)) resp.set_cookie('JSESSIONID', 'Sticky session.') return resp else: info = 'Username or password are incorrect' return render_template('login.html', info=info, static_url_prefix=static_url_prefix)