def login(request, template_name='simpleauth/signin.html'): """Login the user to the website and redirect back.""" next = clean_next(request.GET.get('next')) if request.user.is_authenticated(): return HttpResponseRedirect(next) try: if request.POST['remember_me'] == 'on': # By default keep the user logged in for 3 weeks login_duration = getattr(settings, 'LOGIN_DAYS', 21) * 60 * 60 * 24 except: login_duration = 0 request.session.set_expiry(login_duration) return auth_login(request, template_name=template_name, redirect_field_name='next', authentication_form=RememberMeAuthForm)
def login(request, template_name="simpleauth/signin.html"): """Login the user to the website and redirect back.""" next = clean_next(request.GET.get("next")) if request.user.is_authenticated(): return HttpResponseRedirect(next) try: if request.POST["remember_me"] == "on": # By default keep the user logged in for 3 weeks login_duration = getattr(settings, "LOGIN_DAYS", 21) * 60 * 60 * 24 except: login_duration = 0 request.session.set_expiry(login_duration) return auth_login( request, template_name=template_name, redirect_field_name="next", authentication_form=RememberMeAuthForm )
def logout(request, template_name='simpleauth/logged_out.html'): """Logout the user from the website and redirect back.""" next = clean_next(request.GET.get('next')) auth_logout(request, next_page=next, template_name=template_name) return HttpResponseRedirect(next)
def logout(request, template_name="simpleauth/logged_out.html"): """Logout the user from the website and redirect back.""" next = clean_next(request.GET.get("next")) auth_logout(request, next_page=next, template_name=template_name) return HttpResponseRedirect(next)