Hi, I have created an authentication backend that allows users to login using their username, password and institute id. Although the user can login but it doesn’t get access to the view with login_required decor. When I login to the site it redirects to this url: ' http://xxx.xx.xx.x:xxxx/accounts/login/?next=/accounts/rhome/'. How can I set authentication restriction (or login_requied decor) on specific view in this case? Any suggestions will be greatly appreciated. Here is what I tried.
*backends.py:* *class AuthBackend(object): supports_object_permissions = True supports_anonymous_user = False supports_inactive_user = False def get_user(self, user_id): try: return User.objects.get(pk=user_id) except User.DoesNotExist: return None def authenticate(self, username=None, password=None, institute_id=None):User = get_user_model() try: userid = User.objects.get(username=username) profile = Profile.objects.get( Q(user_id=userid.id) & Q(institute_id=institute_id) ) user = User.objects.get(id = profile.user_id) if user.check_password(password): return user except ObjectDoesNotExist: return None* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0847e5b4-a2ed-4d5c-a539-63207785677fo%40googlegroups.com.