def signup(request): c = Context(request) if c.request.POST: # this user is a Auth_User object, not a Custom User object user = User.create_user(c.request.POST.get('username'), c.request.POST.get('password')) return HttpResponse('signed up') return HttpResponse(SignUp(c))
def signin(request): c = Context(request) if c.request.POST: user = User.objects(username=c.request.POST.get('username')).first() if user and user.check_password(c.request.POST.get('password')): user.backend = 'mongoengine.django.auth.MongoEngineBackend' login(c.request, user) return HttpResponseRedirect(c.request.GET.get('next', '/')) return HttpResponse(SignIn(c))