Hello! Try to write my own backend authenticate function, but users from anothe table can not login. What can it be? Any suggestions?
My code is: ######### anastas/settings.py: AUTHENTICATION_BACKENDS = ( 'anastas.apps.accounts.backend.MyAuthBackend', 'django.contrib.auth.backends.ModelBackend',) ######## anastas/apps/accounts/backend.py class MyAuthBackend: def authenticate(self, username=None, password=None): cursor = connection.cursor() (passwordhash, email) = cursor.execute('SELECT user_password, user_email FROM flock_users WHERE username = %s', [username]) print "passwordhash: ", passwordhash print "password: ", password if md5(password).hexdigest() == passwordhash: try: user = User.objects.get(username=username) print user except User.DoesNotExist: user = User(username=username, password='get it from another database', email=email) user.is_staff=False user.is_superuser=False #user.id = user.get_profile().user_id user.save() return user else: return None return None def get_user(self, username): try: return User.objects.get(username=username) except User.DoesNotExist: return None -- Всего наилучшего! Григорий greg [at] anastasia [dot] ru Письмо отправлено: 2006/11/10 19:51 --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---