mirror of
https://github.com/wger-project/wger.git
synced 2026-02-18 00:17:51 +01:00
Correctly set the authentication backend
This commit is contained in:
@@ -198,13 +198,11 @@ def trainer_login(request, user_pk):
|
||||
or user.has_perm('gym.manage_gyms')):
|
||||
own = True
|
||||
|
||||
# Note: it seems we have to manually set the authentication backend here
|
||||
# - https://docs.djangoproject.com/en/1.6/topics/auth/default/#auth-web-requests
|
||||
# - http://stackoverflow.com/questions/3807777/django-login-without-authenticating
|
||||
# Note: when logging without authenticating, it is necessary to set the
|
||||
# authentication backend
|
||||
if own:
|
||||
del(request.session['trainer.identity'])
|
||||
user.backend = 'django.contrib.auth.backends.ModelBackend'
|
||||
django_login(request, user)
|
||||
django_login(request, user, 'django.contrib.auth.backends.ModelBackend')
|
||||
|
||||
if not own:
|
||||
request.session['trainer.identity'] = orig_user_pk
|
||||
|
||||
Reference in New Issue
Block a user