def login(request): next = request.POST.get('next', '') or request.application_url who_api = get_who_api(request.environ) creds = {'login': request.POST['login'], 'password': request.POST['password']} authenticated, headers = who_api.login(creds) if not authenticated: return login_form(request, error=u'Wrong user name or password.') return HTTPSeeOther(location=unquote_plus(next), headers=headers)
def logout(request): who_api = get_who_api(request.environ) headers = who_api.logout() return HTTPSeeOther(location=request.application_url, headers=headers)