def logout(self): """ handle the logout we delete the cookies from the server and the client and redirect to the login page """ request_context['reponse_redirect'] = True response = redirect('login') if request.cookies.get('user_selfservice'): remove_auth_cookie(request.cookies.get('user_selfservice')) response.delete_cookie('user_selfservice') return response
def login(self): ''' render the selfservice login page ''' c.title = _("LinOTP Self Service Login") # ------------------------------------------------------------------ -- # prepare the realms and put the default realm on the top defaultRealm = getDefaultRealm() realmArray = [defaultRealm] for realm in getRealms(): if realm != defaultRealm: realmArray.append(realm) # ------------------------------------------------------------------ -- # prepare the global context c for the rendering context c.defaultRealm = defaultRealm c.realmArray = realmArray c.realmbox = getRealmBox() context = get_pre_context(c.audit['client']) mfa_login = context['mfa_login'] mfa_3_fields = context['mfa_3_fields'] c.otp = False c.mfa_3_fields = False if mfa_login and mfa_3_fields: c.mfa_3_fields = True response = Response(render('/selfservice/login.mako')) if request.cookies.get('user_selfservice'): remove_auth_cookie(request.cookies.get('user_selfservice')) response.delete_cookie('user_selfservice') return response
def login(self): """ render the selfservice login page """ c.title = _("LinOTP Self Service Login") # ------------------------------------------------------------------ -- # prepare the realms and put the default realm on the top defaultRealm = getDefaultRealm() realmArray = [defaultRealm] for realm in getRealms(): if realm != defaultRealm: realmArray.append(realm) # ------------------------------------------------------------------ -- # prepare the global context c for the rendering context c.defaultRealm = defaultRealm c.realmArray = realmArray c.realmbox = getRealmBox() context = get_pre_context(g.audit["client"]) mfa_login = bool(context["settings"]["mfa_login"]) mfa_3_fields = bool(context["settings"]["mfa_3_fields"]) c.mfa_login = mfa_login c.mfa_3_fields = mfa_login and mfa_3_fields response = Response(render("/selfservice/login.mako")) if request.cookies.get("user_selfservice"): remove_auth_cookie(request.cookies.get("user_selfservice")) response.delete_cookie("user_selfservice") return response
def drop_session_cookie(response): response.delete_cookie(key='helpdesk_session') return response