Ejemplo n.º 1
0
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))
Ejemplo n.º 2
0
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))
Ejemplo n.º 3
0
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))
Ejemplo n.º 4
0
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))