예제 #1
0
def resetpassword(request):
    if request.method == 'POST':
        email = request.session['sessionuser']
        print('0000000000000', email)
        oldpassword = request.POST['oldpassword']
        getoldpasswordfromdb = Register.objects.get(email=email)
        if oldpassword == getoldpasswordfromdb:
            passwordchanged = Register(password=oldpassword)
            passwordchanged.save()
            return render_to_response("resetpassword.html", {
                'status': 'True',
                'mess': 'Password changed successfully'
            },
                                      content_type=RequestContext(request))
        else:
            return render_to_response("resetpassword.html", {
                'status': 'False',
                'mess': 'Old password not match'
            },
                                      content_type=RequestContext(request))
        newpassword = request.POST['password']
        confirmpassword = request.POST['confirmpassword']
        if confirmpassword != newpassword:
            return render_to_response(
                "resetpassword.html", {
                    'status': 'False',
                    'mess': 'ConfirmPassword not match with NewPassword'
                },
                content_type=RequestContext(request))

    return render_to_response("resetpassword.html",
                              context_instance=RequestContext(request))
예제 #2
0
def uregister(request):
    name=request.POST.get("r1")
    contact=request.POST.get("r2")
    password=request.POST.get("r3")
    reg=Register(Name=name,Password=password,Contact=contact)
    reg.save()
    return render(request,"login.html",{"reg":reg,"msg":"saved"})
예제 #3
0
def register(request):
    if request.method == "POST":
        fname = request.POST['fullname']
        uname = request.POST['username']
        pword = request.POST['password']
        #password = hashlib.md5(pword).hexdigest()
        #print(password)
        eid = request.POST['emailid']
        checkuser = Register.objects.filter(emailid=eid).exists()
        if checkuser == True:
            return render_to_response("register.html", {
                'mess': 'Email id already in use.Please check another emailid',
                'status': 'False'
            },
                                      context_instance=RequestContext(request))
        print(checkuser)
        if checkuser == False:
            registersers = Register(
                fullname=fname,
                username=uname,
                #password = md5_crypt.encrypt(pword),
                #password = hashlib.md5(pword),
                #password = hashlib.new(pword).hexdigest(),
                password=pword,
                emailid=eid)
            registersers.save()
            return render_to_response("login.html", {
                'mess': 'Registration successfully',
                'status': 'True'
            },
                                      context_instance=RequestContext(request))

    return render_to_response("register.html",
                              context_instance=RequestContext(request))