Example #1
0
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 )
Example #2
0
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)
Example #3
0
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')
Example #4
0
 def decorated_view(*args, **kwargs):
         name = login_tools.get_username(f.session)
         if name:
             return func(*args, **kwargs)
         return f.redirect('/login')
Example #5
0
def get_creds():
    username = login_tools.get_username(f.session)
    access_token, item_id = bank_sql.get_creds(username)
    return access_token, item_id