

def checkAuth():
    'Check if a valid Session cookie is found and the auth token within is valid\n    '
    authed = False
    indieauth_id = None
    if (('indieauth_id' in session) and ('indieauth_token' in session)):
        indieauth_id = session['indieauth_id']
        indieauth_token = session['indieauth_token']
        app.logger.info('session cookie found')
        if (db is not None):
            key = db.get(('token-%s' % indieauth_token))
            if key:
                data = db.hgetall(key)
                if (data and (data['token'] == indieauth_token)):
                    authed = True
    return (authed, indieauth_id)

dataset/ETHPy150Open bear/python-indieweb/indieweb.py checkAuth/original