Commits

offline committed 3c51823

new functionality of login with remember me ability added

Comments (0)

Files changed (2)

openauth/settings.py

 LOGIN_NOW_URL = get_config("LOGIN_NOW_URL", "openauth-login")
 RESET_PASSWORD_URL = get_config("RESET_PASSWORD_URL", "openauth-login")
 PASSWORD_CHANGED_URL = get_config("PASSWORD_CHANGED_URL", "/")
+REQUIRED_REMEMBER = get_config("REQUIRED_REMEMBER", False)
+REQUIRED_REMEMBER_PARAMETER = get_config("REQUIRED_REMEMBER_PARAMETER", "remember")

openauth/views.py

     if request.method == "POST":
         form = LoginForm(request, request.POST)
         if form.is_valid():
+            if settings.REQUIRED_REMEMBER:
+                if not request.POST.get(settings.REQUIRED_REMEMBER_PARAMETER):
+                    request.session.set_expiry(0)
             redirect_url = request.GET.get("next") or settings.LOGIN_REDIRECT_URL
             messages.success(request, lang.SUCCESSFULL_LOGIN)
             return redirect(redirect_url)