Esempio n. 1
0
File: main.py Progetto: zoyoe/ectool
def register(request):
  if (request.method == "POST"):
    if('email' in request.POST and 'password' in request.POST):
      email = request.POST['email']
      password = request.POST['password']
      user = zuser.registerUser(request,email,password)
      if user:
        if ('requesturl' in request.GET):
          requesturl = request.GET['requesturl']
          return HttpResponseRedirect(zuser.decrypt('url',requesturl));
        else:
          return HttpResponseRedirect("/");
## Need to provide more information of register 
#        return error.ZoyoeSuccess("Success")
######
      else:
        return error.ZoyoeError("User already exist.")
    return error.ZoyoeError("email or password not provided")
  else:
    user = zuser.getCurrentUser(request)
    if not user:
      if ('requesturl' in request.GET):
        context = {}
        context['requesturl'] = request.GET['requesturl']
      return (render_to_response("zoyoe/register.html",context,context_instance=RequestContext(request)))
    else:
      if ('requesturl' in request.GET):
        requesturl = request.GET['requesturl']
        return HttpResponseRedirect(zuser.decrypt('url',requesturl));
      else:
        return HttpResponseRedirect("/");
Esempio n. 2
0
def login(request):
    if (request.method == "POST"):
        if ('email' in request.POST and 'password' in request.POST):
            email = request.POST['email']
            password = request.POST['password']
            user = zuser.loginUser(request, email, password)
            if user:
                if ('requesturl' in request.POST):
                    requesturl = request.POST['requesturl']
                    return HttpResponseRedirect(
                        zuser.decrypt('url', requesturl))
                return error.ZoyoeSuccess("Success")
            else:
                if ('requesturl' in request.POST):
                    requesturl = request.POST['requesturl']
                    error.builderror(request,
                                     "User not exist or password not correct")
                    return HttpResponseRedirect("/login/?requesturl=" +
                                                requesturl)
                else:
                    return error.ZoyoeError(
                        "User not exist or password not correct")
        return error.ZoyoeError("email or password not provided")
    else:
        context = {}
        if ('requesturl' in request.GET):
            context['requesturl'] = request.GET['requesturl']
        return (render_to_response("zoyoe/login.html",
                                   context,
                                   context_instance=RequestContext(request)))
Esempio n. 3
0
def register(request):
    if (request.method == "POST"):
        if ('email' in request.POST and 'password' in request.POST):
            email = request.POST['email']
            password = request.POST['password']
            user = zuser.registerUser(request, email, password)
            if user:
                if ('requesturl' in request.GET):
                    requesturl = request.GET['requesturl']
                    return HttpResponseRedirect(
                        zuser.decrypt('url', requesturl))
                else:
                    return HttpResponseRedirect("/")


## Need to provide more information of register
#        return error.ZoyoeSuccess("Success")
######
            else:
                return error.ZoyoeError("User already exist.")
        return error.ZoyoeError("email or password not provided")
    else:
        user = zuser.getCurrentUser(request)
        if not user:
            if ('requesturl' in request.GET):
                context = {}
                context['requesturl'] = request.GET['requesturl']
            return (render_to_response(
                "zoyoe/register.html",
                context,
                context_instance=RequestContext(request)))
        else:
            if ('requesturl' in request.GET):
                requesturl = request.GET['requesturl']
                return HttpResponseRedirect(zuser.decrypt('url', requesturl))
            else:
                return HttpResponseRedirect("/")
Esempio n. 4
0
File: main.py Progetto: zoyoe/ectool
def login(request):
  if (request.method == "POST"):
    if('email' in request.POST and 'password' in request.POST):
      email = request.POST['email']
      password = request.POST['password']
      user = zuser.loginUser(request,email,password)
      if user:
        if ('requesturl' in request.POST):
          requesturl = request.POST['requesturl']
          return HttpResponseRedirect(zuser.decrypt('url',requesturl));
        return error.ZoyoeSuccess("Success")
      else:
        if ('requesturl' in request.POST):
          requesturl = request.POST['requesturl']
          error.builderror(request,"User not exist or password not correct")
          return HttpResponseRedirect("/login/?requesturl=" + requesturl);
        else:
          return error.ZoyoeError("User not exist or password not correct")
    return error.ZoyoeError("email or password not provided")
  else:
    context = {};
    if ('requesturl' in request.GET):
      context['requesturl'] = request.GET['requesturl']
    return (render_to_response("zoyoe/login.html",context,context_instance=RequestContext(request)))