juser/change_info/ fix password can be ignore

pull/26/head
liuzheng712 9 years ago
parent 4397819b44
commit 84992746de

@ -433,10 +433,9 @@ def change_info(request):
password = request.POST.get('password', '')
email = request.POST.get('email', '')
if '' in [name, password, email]:
if '' in [name, email]:
error = '不能为空'
if len(password) < 6:
if len(password) > 0 and len(password) < 6:
error = '密码须大于6位'
if not error:
@ -444,8 +443,9 @@ def change_info(request):
# password = CRYPTOR.md5_crypt(password)
User.objects.filter(id=user_id).update(name=name, email=email)
user.set_password(password)
user.save()
if len(password) > 0:
user.set_password(password)
user.save()
msg = '修改成功'
return render_to_response('juser/change_info.html', locals(), context_instance=RequestContext(request))

@ -41,7 +41,7 @@
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">密码<span class="red-fonts">*</span></label>
<label for="password" class="col-sm-2 control-label">密码</label>
<div class="col-sm-8">
<input id="password" name="password" placeholder="Password" type="password" class="form-control">
<span class="help-block m-b-none">
@ -91,7 +91,7 @@ $('#userForm').validator({
fields: {
"password": {
rule: "required;length[6~50]",
rule: "length[6~50]",
tip: "输入密码",
ok: "",
msg: {required: "必须填写!"}

Loading…
Cancel
Save