FIX password length validate
This commit is contained in:
parent
0cd790ecac
commit
b7b096d6d7
|
@ -62,7 +62,11 @@ class OauthController < ApplicationController
|
||||||
email = params[:mail]
|
email = params[:mail]
|
||||||
password = params[:password]
|
password = params[:password]
|
||||||
callback_url = params[:callback_url]
|
callback_url = params[:callback_url]
|
||||||
platform = params[:plathform] || 'forge'
|
platform = params[:plathform] || 'educoder'
|
||||||
|
|
||||||
|
if User.where(mail: email).exists?
|
||||||
|
render_error("该邮箱已使用过.") and return
|
||||||
|
end
|
||||||
|
|
||||||
result = autologin_register(login, email, password, platform)
|
result = autologin_register(login, email, password, platform)
|
||||||
logger.info "[Oauth educoer] =====#{result}"
|
logger.info "[Oauth educoer] =====#{result}"
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
if(!password){
|
if(!password){
|
||||||
$(".passwordCheck span").html("请输入账号密码");
|
$(".passwordCheck span").html("请输入账号密码");
|
||||||
return;
|
return;
|
||||||
|
}else if(password.length < 8){
|
||||||
|
$(".passwordCheck span").html("密码最少为8位数");
|
||||||
|
return;
|
||||||
}else{
|
}else{
|
||||||
$(".passwordCheck span").html("");
|
$(".passwordCheck span").html("");
|
||||||
}
|
}
|
||||||
|
@ -57,11 +60,19 @@
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
if (data) {
|
if (data) {
|
||||||
|
if(data.message){
|
||||||
|
$(".emailCheck span").html("该邮箱已存在.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// data.redirect contains the string URL to redirect to
|
// data.redirect contains the string URL to redirect to
|
||||||
// window.location.href = "<%#= params[:callback_url] %>";
|
// window.location.href = "<%#= params[:callback_url] %>";
|
||||||
window.location.href = data.callback_url;
|
window.location.href = data.callback_url;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
error: function (data) {
|
||||||
|
console.log('ajax error handling',data);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue