166 lines
7.4 KiB
Plaintext
166 lines
7.4 KiB
Plaintext
<div class="new_register">
|
||
<div class="new_register_con ">
|
||
<div class="new_login_box ">
|
||
<h2 class="new_login_h2">注册<a href="<%= signin_path %>" class="fr mt5">已有账号 请登录</a><div class="cl"></div></h2>
|
||
<div class="new_login_form">
|
||
<%= form_for :user, :url => register_path,:method=>'post', :html => {:id=>'main_reg_form'} do |f| %>
|
||
<%= error_messages_for 'user' %>
|
||
<ul >
|
||
<li class="new_register_li">
|
||
<%= f.text_field :mail, :size => 25, :class => 'new_register_input' , :placeholder => "请输入邮箱地址"%>
|
||
<p class="new_login_error" id="mail_req" style="display: none">请输入正确的邮箱</p>
|
||
</li>
|
||
<li class="new_register_li">
|
||
<%= f.password_field :password, :placeholder => "请输入密码", :class => 'new_register_input' %>
|
||
<p class="new_login_error" id="passwd_req" style="display: none">请输入8-16位密码,区分大小写,不能使用空格!</p>
|
||
</li>
|
||
<li class="new_register_li">
|
||
<%= f.password_field :password_confirmation, :placeholder => "请再次输入密码", :class=> 'new_register_input' %>
|
||
<p class="new_login_error" id="confirm_req" style="display: none">两次密码不一致!</p>
|
||
</li>
|
||
<li class="new_register_li">
|
||
<%= f.text_field :login, :placeholder => "请输入用户登录名", :class => 'new_register_input'%>
|
||
<p class="new_login_error" id="login_req" style="display: none">只能使用英文字母和数字,必须以字母开头,长度不少于4个字符、不超过15个字符</p>
|
||
</li>
|
||
<li>
|
||
<label><input type="checkbox" checked id="read_and_confirm" onchange="changeRegisterBtn(this);" class=" new_login_check">我已阅读并接受<a href="<%= agreement_path %>" >Trustie服务协议条款</a></label>
|
||
</li>
|
||
<li>
|
||
<div id="loginUpButton">
|
||
<a href="javascript:void(0);" id="regist_btn" onclick="register();" class ="new_login_submit" style="text-decoration:none;">注册</a>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
<% end %>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="cl"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
$(document).ready(function(){
|
||
$(".homepageSearchIcon").click(function(){
|
||
var val=$('input:radio[name="search_type"]:checked').val();
|
||
if(val==null){
|
||
$("#navSearchAlert").css({display:"block"});
|
||
}
|
||
else {
|
||
$("#navSearchAlert").css({display:"none"});
|
||
}
|
||
});
|
||
});
|
||
|
||
$(document).ready(function(){
|
||
$(".navHomepageSearchBoxcontainer").mouseover(function(){
|
||
$(".navSearchTypeBox").css({display:"block"});
|
||
});
|
||
$(".navHomepageSearchBoxcontainer").mouseout(function(){
|
||
$(".navSearchTypeBox").css({display:"none"});
|
||
});
|
||
})
|
||
$(document).ready(function(){
|
||
if(<%= @login%>){
|
||
$("#signUpBox").css({display:"none"});
|
||
$("#loginInBox").css({display:"block"});
|
||
}else{
|
||
$("#signUpBox").css({display:"block"});
|
||
$("#loginInBox").css({display:"none"});
|
||
}
|
||
});
|
||
|
||
var $login_correct = false;
|
||
var $mail_correct = false;
|
||
var $passwd_correct = false;
|
||
var $passwd_comfirm_correct = false;
|
||
jQuery(document).ready(function () {
|
||
var $login = $('#user_login')
|
||
var $mail = $('#user_mail')
|
||
var $password = $('#user_password')
|
||
var $password_confirmation = $('#user_password_confirmation')
|
||
$login.blur(function (event) {
|
||
if ($(this).is('#user_login')) {
|
||
if (/^[a-zA-Z][a-zA-Z\d]{3,14}$/.test(this.value) == false){
|
||
$('#login_req').html('<span style="color: #2384cd">只能使用英文字母和数字,必须以字母开头</span>');
|
||
$('#login_req').show();
|
||
return ;
|
||
}
|
||
else{
|
||
$.get(
|
||
'<%=account_valid_ajax_path%>',
|
||
{ valid: "login",
|
||
value: this.value },
|
||
function (data) {
|
||
if (data.valid) {
|
||
$('#login_req').html('<span style="color: green">'+data.message+'</span>');
|
||
$login_correct = true;
|
||
} else {
|
||
$('#login_req').html( '<span style="color: #2384cd">'+data.message+'</span>');
|
||
$login_correct = false;
|
||
}
|
||
$('#login_req').css('display','block');
|
||
});
|
||
}
|
||
|
||
}
|
||
|
||
// ;
|
||
});
|
||
|
||
$mail.blur(function (event) {
|
||
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
|
||
$('#mail_req').html( '<span style="color: #2384cd">邮件格式不对</span>').show();
|
||
$mail_correct = false;
|
||
return ;
|
||
}
|
||
if ($(this).is('#user_mail')) {
|
||
$.get('<%=account_valid_ajax_path%>',
|
||
{ valid: "mail",
|
||
value: this.value },
|
||
function (data) {
|
||
if (data.valid) {
|
||
$('#mail_req').html( '<span style="color: green">'+data.message+'</span>' );
|
||
$mail_correct = true;
|
||
} else {
|
||
$('#mail_req').html( '<span style="color: #2384cd">'+data.message+'</span>' );
|
||
$mail_correct = false;
|
||
}
|
||
$('#mail_req').css('display','block');
|
||
});
|
||
}
|
||
;
|
||
});
|
||
$password.blur(function () {
|
||
var pas1 = document.getElementById("user_password").value;
|
||
var password_min_length = <%= Setting.password_min_length.to_i %>
|
||
if (pas1.length >= password_min_length) {
|
||
$('#passwd_req').html('');
|
||
$passwd_correct = true;
|
||
}
|
||
else {
|
||
$('#passwd_req').html( '<span style="color: #2384cd">'+'<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>'+'</span>');
|
||
$passwd_correct = false;
|
||
}
|
||
$('#passwd_req').css('display','block');
|
||
|
||
|
||
});
|
||
$password_confirmation.blur(function () {
|
||
var password_min_length = <%= Setting.password_min_length.to_i %>
|
||
var pas1 = document.getElementById("user_password").value;
|
||
var pas2 = document.getElementById("user_password_confirmation").value;
|
||
if (pas1.length >= password_min_length && pas1 == pas2 ) {
|
||
$('#confirm_req').html('<span style="color: green">'+'<%= l(:setting_password_success) %>'+'</span>');
|
||
$passwd_comfirm_correct = true;
|
||
}
|
||
else {
|
||
$('#confirm_req').html('<span style="color: #2384cd">'+'<%= l(:setting_password_error) %>'+'</span>');
|
||
$passwd_comfirm_correct = false;
|
||
|
||
}
|
||
$('#confirm_req').css('display','block');
|
||
});
|
||
});
|
||
</script>
|