1.在用户注册页面添加了email字段,并附带验证;
2.统一了username和email字段的唯一性验证方法。 [ci skip]
This commit is contained in:
@@ -2,6 +2,11 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
|||||||
$("#register-form")
|
$("#register-form")
|
||||||
.formValidation({
|
.formValidation({
|
||||||
framework: "bootstrap",
|
framework: "bootstrap",
|
||||||
|
icon: {
|
||||||
|
valid: 'glyphicon glyphicon-ok',
|
||||||
|
invalid: 'glyphicon glyphicon-remove',
|
||||||
|
validating: 'glyphicon glyphicon-refresh'
|
||||||
|
},
|
||||||
fields: {
|
fields: {
|
||||||
username: {
|
username: {
|
||||||
validators: {
|
validators: {
|
||||||
@@ -50,6 +55,21 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
|||||||
message: "两次输入的密码必须一致"
|
message: "两次输入的密码必须一致"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
validators: {
|
||||||
|
notEmpty: {
|
||||||
|
message: "请填写电子邮箱邮箱地址"
|
||||||
|
},
|
||||||
|
emailAddress: {
|
||||||
|
message: "请填写有效的邮箱地址"
|
||||||
|
},
|
||||||
|
remoteCSRF: {
|
||||||
|
message: "您已经注册过了",
|
||||||
|
url: "/api/email_check/",
|
||||||
|
field: 'email'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,8 +92,6 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
|||||||
bs_alert(data.data);
|
bs_alert(data.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -14,6 +14,10 @@
|
|||||||
<label for="real_name">真实姓名</label>
|
<label for="real_name">真实姓名</label>
|
||||||
<input type="text" class="form-control input-lg" id="real_name" name="real_name" placeholder="真实姓名">
|
<input type="text" class="form-control input-lg" id="real_name" name="real_name" placeholder="真实姓名">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="email">邮箱地址</label>
|
||||||
|
<input type="email" class="form-control input-lg" id="email" name="email" placeholder="邮箱地址">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">密码</label>
|
<label for="password">密码</label>
|
||||||
<input type="password" class="form-control input-lg" id="password" name="password" placeholder="密码">
|
<input type="password" class="form-control input-lg" id="password" name="password" placeholder="密码">
|
||||||
|
|||||||
Reference in New Issue
Block a user