def login(request): app_url = request.application_url next = request.POST.get('next', '') or app_url who_api = get_who_api(request) creds = {'login': request.POST['login'], 'password': request.POST['password']} authenticated, headers = who_api.login(creds) if not authenticated: return login_form(request, failed=True) return HTTPSeeOther(location=unquote_plus(next), headers=headers)
def logout(request): who_api = get_who_api(request) headers = who_api.logout() return HTTPSeeOther(location=request.application_url, headers=headers)