I certainly have. It works great! First I set this in settings.py:
AUTHENTICATION_BACKENDS = (
'mongo_auth.UserBackend',
)
mongo_auth.py looks like this::
from django.contrib.auth.backends import ModelBackend
from django_mongokit import connection, get_database
from users.models import User
class UserBackend(ModelBackend):
def authenticate(self, username=None, password=None):
collection = get_database(connection).users
user = collection.User.one({'username': username})
if user and user.check_password(password):
return user
def get_user(self, username):
collection = get_database(connection).users
user = collection.User.one({'username':username})
if user:
return user
As you probably know now I'm using django-mongokit to wrap the
MongoKit stuff and I've developed a model for the User which has
worked really well for me. I've attached it to this email. I hope that
works.
On 28 April 2010 23:05, BRLYNS <
brl...@gmail.com> wrote:
> Has anyone successfully integrated mongokit as a django auth and sessions backend? If so, could you share the code?
>
> Cheers and thanks to everyone in this group for helping out!
--
Peter Bengtsson,
work
www.fry-it.com
home
www.peterbe.com
hobby
www.issuetrackerproduct.com
fun
crosstips.org