Apparently it was just a sort of "Session" problem. It was solved trying to
change the user to authenticate.
I still have another problem : during the "authentication" phase, if an
user doesn't exist (and some conditions are true), I create a new user in
the Database. I don't know why but when I do "user =
MyUser(username="toto", is_active=True)" the authenticate method returns
even if I didn't call return explicitly. No error, and a success response...
Thanks for any advice
Le jeudi 4 septembre 2014 12:48:29 UTC+2, Jérôme Sivadier a écrit :
>
> Hello,
>
> I would like to have a custom authentication process with my Mezzanine
> website. I've read in Django documentation that I could create an
> authentication backend and add it to my settings.py but it doesn't seem to
> work as expected.f
> Basically I've created a class that look like this in my application :
>
> from django.contrib.auth.models import User
> from django.contrib.auth.backends import ModelBackend
>
> class AuthBackend(ModelBackend):
> def authenticate(self, username=None, password=None, **kwargs):
> print "CUSTOM AUTH"
> return ModelBackend.authenticate(self, username=username,
> password=password, **kwargs)
>
> In my hard drive, this class in located in the file : my_app / auth /
> custom_auth.py
>
> So I've try to modify my local_settings.py with the following line :
>
> AUTHENTICATION_BACKENDS = ("my_app.auth.custom_auth.AuthBackend",)
>
> And I've run again my application.... without success. Authentication
> works but "CUSTOM AUTH" is never printed, so the application uses the
> default auth backend.
>
> Any ideas? Did I forget something?
> Thanks in advance !
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.