def authenticate_user( db ): oid = webopenid.status() if oid: return oid authentication_token = web.cookies().get( "authentication_token" ) user_from_token = authenticate_token( db, authentication_token ) if user_from_token is not None: return user_from_token auth = web.ctx.env.get( "HTTP_AUTHORIZATION" ) if auth is None: return None user, pw = base64.decodestring( re.sub( "^Basic ", "", auth ) ).split( ":" ) if user in known_users and known_users[user] == pw: return user else: raise unathorized()
def authenticate_user(db): oid = webopenid.status() if oid: return oid authentication_token = web.cookies().get("authentication_token") user_from_token = authenticate_token(db, authentication_token) if user_from_token is not None: return user_from_token auth = web.ctx.env.get("HTTP_AUTHORIZATION") if auth is None: return None user, pw = base64.decodestring(re.sub("^Basic ", "", auth)).split(":") if user in known_users and known_users[user] == pw: return user else: raise unathorized()
def GET(self): if webopenid.status(): return "Logged in." else: web.header('Content-Type', 'text/html') return webopenid.form('/openid')
def GET(self): if webopenid.status(): return "Logged in." else: web.header("Content-Type", "text/html") return webopenid.form("/openid")