We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a69f68 commit 6db9646Copy full SHA for 6db9646
djangosaml2/views.py
@@ -109,12 +109,8 @@ def login(request,
109
# SAML_IGNORE_AUTHENTICATED_USERS_ON_LOGIN setting. If that setting
110
# is True (default value) we will redirect him to the came_from view.
111
# Otherwise, we will show an (configurable) authorization error.
112
- if not request.user.is_anonymous():
113
- try:
114
- redirect_authenticated_user = settings.SAML_IGNORE_AUTHENTICATED_USERS_ON_LOGIN
115
- except AttributeError:
116
- redirect_authenticated_user = True
117
-
+ if request.user.is_authenticated:
+ redirect_authenticated_user = getattr(settings, 'SAML_IGNORE_AUTHENTICATED_USERS_ON_LOGIN', True)
118
if redirect_authenticated_user:
119
return HttpResponseRedirect(came_from)
120
else:
0 commit comments