예제 #1
0
def changepass():
    if request.method == "POST":
        passwd_info = dict((k, v[0]) for k, v in dict(request.form).items())
        print passwd_info
        if len(passwd_info) == 3:
            if passwd_info["password"] != passwd_info["re_password"]:
                return json.dumps({
                    "code": 1,
                    "errmsg": "The tow password is different"
                })
        if not passwd_info.get("password", "None") or not passwd_info.get(
                "re_password", "None"):
            errmsg = "password can not be empty"
            return json.dumps({'code': '1', 'errmsg': errmsg})
        else:
            uid = passwd_info["id"]
            password = passwd_info["password"]
            modpasswd(password, uid)
            return json.dumps({'code': '0', 'result': "change sucess"})
예제 #2
0
def changepass():
    if request.method == "GET":
        return render_template("changepass.html")
    if request.method == "POST":
        passwd_info = dict((k, v[0]) for k, v in dict(request.form).items())
        if not passwd_info.get("password", "None") or not passwd_info.get(
                "oldpassword", "None"):
            errmsg = "password can not be empty"
            return render_template("changepass.html", result=errmsg)
        if passwd_info["oldpassword"] != checkuser(session.get("name")):
            oldpassword = checkuser(session.get("name"))
            print oldpassword
            errmsg = "your input oldpassword is error"
            return render_template("changepass.html", result=errmsg)
        else:
            name = session.get("name")
            password = passwd_info["password"]
            print name
            print password
            modpasswd(password, name)
            return redirect('/userlist')
예제 #3
0
def cgpasswd():
    if request.method == "GET":
        uid = request.args.get("id")
        return render_template("cgpasswd.html",uid=uid)
    if request.method == "POST":
        passwd_dic = dict((k,v[0]) for k ,v in dict(request.form).items())
        password = checkuser({"id":passwd_dic["id"]})
        print passwd_dic
        print password
        if passwd_dic["o_password"] != password:
            errmsg = "password is error"
            data = json.dumps({"tag":0,"msg":errmsg})
            return data
        if passwd_dic["n_password"] != passwd_dic["r_password"]:
            errmsg = "The two passwords you typed do not match"
            data = json.dumps({"tag":0,"msg":errmsg})
            return data
        pw_data={"id":passwd_dic['id'],"password":passwd_dic['n_password']}
        modpasswd(pw_data)
        data=json.dumps({"tag":1})
        return data
예제 #4
0
def cgpasswd():
    if request.method == "GET":
        uid = request.args.get("id")
        return render_template("cgpasswd.html",uid=uid)
    if request.method == "POST":
        passwd_dic = dict((k,v[0]) for k ,v in dict(request.form).items())
        password = checkuser({"id":passwd_dic["id"]})
        print passwd_dic
        print password
        if passwd_dic["o_password"] != password:
            errmsg = "password is error"
            data = json.dumps({"tag":0,"msg":errmsg})
            return data
        if passwd_dic["n_password"] != passwd_dic["r_password"]:
            errmsg = "The two passwords you typed do not match"
            data = json.dumps({"tag":0,"msg":errmsg})
            return data
        pw_data={"id":passwd_dic['id'],"password":passwd_dic['n_password']}
        modpasswd(pw_data)
        data=json.dumps({"tag":1})
        return data
예제 #5
0
def changepass():
    if request.method == "GET":
        username = session.get("name")
        return render_template("changepass.html", username=username)
    if request.method == "POST":
        passwd_info = dict((k, v[0]) for k, v in dict(request.form).items())
        if not passwd_info.get("password", "None") or not passwd_info.get(
                "oldpassword", "None"):
            errmsg = "password can not be empty"
            return json.dumps({'code': '1', 'errmsg': errmsg})
        if passwd_info["oldpassword"] != checkuser(session.get("name")):
            oldpassword = checkuser(session.get("name"))
            print oldpassword
            errmsg = "your input oldpassword is error"
            return json.dumps({'code': '1', 'errmsg': errmsg})
        else:
            name = session.get("name")
            password = passwd_info["password"]
            print name
            print password
            modpasswd(password, name)
            return json.dumps({'code': '0', 'result': "change sucess"})
예제 #6
0
def changepass():
	if request.method=="GET":
		return render_template("changepass.html")
	if request.method=="POST":
		passwd_info=dict((k,v[0]) for k,v in dict(request.form).items())
		if not passwd_info.get("password","None") or not passwd_info.get("oldpassword","None"):
			errmsg = "password can not be empty"
#			return render_template("changepass.html",result=errmsg)
			return json.dumps({'code':'1','errmsg':errmsg})
		if passwd_info["oldpassword"] != checkuser(session.get("name")):
			oldpassword=checkuser(session.get("name"))
			print oldpassword
			errmsg= "your input oldpassword is error"
#			return render_template("changepass.html",result=errmsg)
			return json.dumps({'code':'1','errmsg':errmsg})
		else:
			name=session.get("name")
			password=passwd_info["password"]
			print name
			print password
			modpasswd(password,name)
#			return  redirect('/userlist')
			return json.dumps({'code':'0','result':"change sucess"})