1.在用户注册页面添加了email字段,并附带验证;

2.统一了username和email字段的唯一性验证方法。
[ci skip]
This commit is contained in:
sxw
2015-08-05 19:40:02 +08:00
parent 34ccdd5e0e
commit c868441d61
2 changed files with 24 additions and 2 deletions

View File

@@ -2,6 +2,11 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
$("#register-form")
.formValidation({
framework: "bootstrap",
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
validators: {
@@ -50,6 +55,21 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
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);
}
}
})
});
});