def logout(): if f.request.method == 'POST': try: del f.session['username'] except KeyError: pass return f.redirect('/login') if f.request.method == 'GET': role = login_tools.get_role(login_tools.get_username(f.session)) return f.render_template('login_system/logout.html', role = role )
def login(): if f.request.method == 'GET': name = login_tools.get_username(f.session) if name == False: return f.render_template('login_system/login.html') if name != False: return logout() if f.request.method == 'POST': return login_tools.login_url(f.request, f.session)
def get_access_token(): global public_token public_token = request.form['public_token'] exchange_response = client.Item.public_token.exchange(public_token) item_id = exchange_response['item_id'] access_token = exchange_response['access_token'] username = login_tools.get_username(f.session) bank_sql.set_creds(username, access_token, item_id) return render_template('bank_system/begin.html', message='Connected')
def decorated_view(*args, **kwargs): name = login_tools.get_username(f.session) if name: return func(*args, **kwargs) return f.redirect('/login')
def get_creds(): username = login_tools.get_username(f.session) access_token, item_id = bank_sql.get_creds(username) return access_token, item_id