#12233: Redirect logged in user
-------------------------------------+-------------------------------------
Reporter: dmathieu | Owner:
Type: New feature | aaronbassett
Component: contrib.auth | Status: assigned
Severity: Normal | Version:
Keywords: | Resolution:
authentication,login | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by buchanae):
I've done some work on this here:
https://github.com/abuchanan/django/tree/ticket_12233
Still needs work.
I changed the argument name to "redirect_authenticated_user" and the value
type to Boolean (whether authenticated users should be redirected) which
defaults to False because I figured that would be more backwards-
compatible.
The redirect URL would use the same mechanism as normal user login.
I'm not sure yet how to handle a case where the redirect url is the login
page (creating an infinite redirect loop). I guess I could chalk that up
to user error and just let it happen.
I've also considered that this may be cleaner as a view decorator.
Thoughts on that?
Something to the effect of:
{{{
@redirect_authenticated_user(redirect_field_name=REDIRECT_FIELD_NAME,
redirect_url=settings.LOGIN_REDIRECT_URL)
def your_view(request): pass
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/12233#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.c501827c8b74045e7f879a616a8bd3df%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.