Commits

Sergey Maranchuk committed 88110af

fix #40 : not_authenticated decorator should respect LOGIN_REDIRECT_URL

Comments (0)

Files changed (1)

django_authopenid/views.py

         'message': message
     })
 
-
 def not_authenticated(func):
     """ decorator that redirect user to next page if
     he is already logged."""
     def decorated(request, *args, **kwargs):
         if request.user.is_authenticated():
-            next = request.GET.get("next", "/")
+            next = request.GET.get("next", settings.LOGIN_REDIRECT_URL)
             return HttpResponseRedirect(next)
         return func(request, *args, **kwargs)
     return decorated
         'form': form,
         redirect_field_name: redirect_to
     }, context_instance=_build_context(request, extra_context=extra_context))     
-    
+
 @login_required
 def dissociate(request, template_name="authopenid/dissociate.html",
         dissociate_form=OpenidDissociateForm, 
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.