Re: Problem with AD (LDAP) authentication
On Thu, Jul 9, 2009 at 4:44 PM, TechnicalBardwrote: > > Have discovered what works - but it goes against the docs... > > I needed to set User.is_active = True. The permissions for admin > (has_perm) appears to check this flag and returns False for inactive > users. > > Problem solved. > What docs does this go against? I don't see how what you have found goes against the general auth doc: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.is_active Logging in to admin is not mentioned there. This is the documentation for django.contrib.auth, which is independent of the admin app (though admin is an app that uses services of auth). It is mentioned that if, for your app, you want to disable login for users with is_active = False, then you need to do that in your own login view. Admin happens to be an app that has done that. Admin actually goes further and only allows login for users who have both is_active and is_staff set to True: http://code.djangoproject.com/browser/django/tags/releases/1.0.2/django/contrib/admin/sites.py#L260 This behavior is also mentioned in the FAQ: http://docs.djangoproject.com/en/dev/faq/admin/#i-can-t-log-in-when-i-enter-a-valid-username-and-password-it-brings-up-the-login-page-again-with-a-please-enter-a-correct-username-and-password-error Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with AD (LDAP) authentication
Have discovered what works - but it goes against the docs... I needed to set User.is_active = True. The permissions for admin (has_perm) appears to check this flag and returns False for inactive users. Problem solved. On Jul 9, 10:15 am, TechnicalBardwrote: > Alas - that doesn't make a difference... > > On Jul 8, 4:29 pm, Frédéric Hébert wrote: > > > > > Hi, > > > Maybe, should you put is_staff=True : > > >http://docs.djangoproject.com/en/dev/topics/auth/#users > > > Regards, > > > Frédéric > > > 2009/7/8 Technicalbard : > > > > I'm trying to write an Active Directory / LDAP authenication, and I'm > > > having problems. The code is at:http://dpaste.com/hold/64752/ > > > > When I set this authentication and then try to go > > > tohttp://localhost:8000/admin > > > and login to the development server, it authenticates against the LDAP > > > server (the print statements indicate as such in the django console), > > > and it does create a new django user in the database. But it doesn't > > > redirect me to the admin interface. It brings back the login screen > > > with the error message: > > > > Please enter a correct username and password. Note that both fields > > > are case-sensitive. > > > > Except I know that I did because the database was updated. What am I > > > doing wrong? > > > --http://www.openidfrance.fr/fhebert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with AD (LDAP) authentication
Alas - that doesn't make a difference... On Jul 8, 4:29 pm, Frédéric Hébertwrote: > Hi, > > Maybe, should you put is_staff=True : > > http://docs.djangoproject.com/en/dev/topics/auth/#users > > Regards, > > Frédéric > > 2009/7/8 Technicalbard : > > > > > > > > > I'm trying to write an Active Directory / LDAP authenication, and I'm > > having problems. The code is at:http://dpaste.com/hold/64752/ > > > When I set this authentication and then try to go > > tohttp://localhost:8000/admin > > and login to the development server, it authenticates against the LDAP > > server (the print statements indicate as such in the django console), > > and it does create a new django user in the database. But it doesn't > > redirect me to the admin interface. It brings back the login screen > > with the error message: > > > Please enter a correct username and password. Note that both fields > > are case-sensitive. > > > Except I know that I did because the database was updated. What am I > > doing wrong? > > --http://www.openidfrance.fr/fhebert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with AD (LDAP) authentication
Hi, Maybe, should you put is_staff=True : http://docs.djangoproject.com/en/dev/topics/auth/#users Regards, Frédéric 2009/7/8 Technicalbard: > > I'm trying to write an Active Directory / LDAP authenication, and I'm > having problems. The code is at: http://dpaste.com/hold/64752/ > > When I set this authentication and then try to go to > http://localhost:8000/admin > and login to the development server, it authenticates against the LDAP > server (the print statements indicate as such in the django console), > and it does create a new django user in the database. But it doesn't > redirect me to the admin interface. It brings back the login screen > with the error message: > > Please enter a correct username and password. Note that both fields > are case-sensitive. > > Except I know that I did because the database was updated. What am I > doing wrong? > > > -- http://www.openidfrance.fr/fhebert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem with AD (LDAP) authentication
I'm trying to write an Active Directory / LDAP authenication, and I'm having problems. The code is at: http://dpaste.com/hold/64752/ When I set this authentication and then try to go to http://localhost:8000/admin and login to the development server, it authenticates against the LDAP server (the print statements indicate as such in the django console), and it does create a new django user in the database. But it doesn't redirect me to the admin interface. It brings back the login screen with the error message: Please enter a correct username and password. Note that both fields are case-sensitive. Except I know that I did because the database was updated. What am I doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---