Use request.user.is_authenticated as a bool with recent Django (#216)
Django 1.10 changed request.user.is_authenticated from a function to a boolean and Django 2.0 dropped the backward compatibility. In order to use django-oidc-provider with Django 2.0, AuthorizeView needs to handle request.user.is_authenticated as a boolean.
This commit is contained in:
parent
65c6cc6fec
commit
43d990c04d
|
@ -65,7 +65,7 @@ class AuthorizeView(View):
|
||||||
try:
|
try:
|
||||||
authorize.validate_params()
|
authorize.validate_params()
|
||||||
|
|
||||||
if request.user.is_authenticated():
|
if (request.user.is_authenticated if django.VERSION >= (1, 10) else request.user.is_authenticated()):
|
||||||
# Check if there's a hook setted.
|
# Check if there's a hook setted.
|
||||||
hook_resp = settings.get('OIDC_AFTER_USERLOGIN_HOOK', import_str=True)(
|
hook_resp = settings.get('OIDC_AFTER_USERLOGIN_HOOK', import_str=True)(
|
||||||
request=request, user=request.user,
|
request=request, user=request.user,
|
||||||
|
|
Loading…
Reference in a new issue