offline avatar 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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.