77 lines
3.4 KiB
Plaintext
77 lines
3.4 KiB
Plaintext
<div id="muban_popup_box" style="width:400px;">
|
|
<div class="muban_popup_top">
|
|
<h3 class="fl">更换邮箱</h3>
|
|
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal()"></a>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="sy_popup_con" style="width:380px;">
|
|
<ul class="sy_popup_add" >
|
|
|
|
<li class="center mb5" style="line-height:20px;text-align: center;">
|
|
<li style="margin-left: 40px">
|
|
<span class="c_red f12"></span> 原邮箱 :
|
|
<span style="width: 200px"><%= user.mail %></span>
|
|
</li>
|
|
<div class="c1"></div>
|
|
<li style="margin-left: 40px">
|
|
<span class="c_red f12"></span> 新邮箱 :
|
|
<input type="text" style="width:200px" id="user_mail" name="user[mail]" placeholder="请输入邮箱地址">
|
|
<p class="new_login_error fl" id="mail_req" style="display: none;margin-left: 68px;">请输入正确的邮箱</p>
|
|
</li>
|
|
</li>
|
|
<div class="clear"></div>
|
|
<li class="mt10">
|
|
<label class="mr27"> </label>
|
|
<a href="javascript:void(0);" class="sy_btn_grey fl" onclick="hideModal()">取 消</a>
|
|
<a href="javascript:void(0);" class="sy_btn_blue fl ml20" onclick="submit_user_emails()">确 定</a>
|
|
<div class="cl"></div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var $mail_correct = false;
|
|
var $mail = $('#user_mail');
|
|
$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: #c00202">邮件格式不对</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: #c00202">'+data.message+'</span>' );
|
|
$mail_correct = false;
|
|
}
|
|
$('#mail_req').css('display','block');
|
|
});
|
|
}
|
|
});
|
|
|
|
function submit_user_emails(){
|
|
if($mail_correct == false){
|
|
return
|
|
}else{
|
|
// 改变邮箱地址
|
|
$.get('<%= account_change_email_path(:user_id => @user.id) %>',
|
|
{ valid: "mail",
|
|
value: document.getElementById("user_mail").value },
|
|
function (data){
|
|
$("#user_email_show").html(data.email);
|
|
// 更改邮箱地址后,直接给用户发送邮件
|
|
$.ajax({
|
|
url: "<%= resendmail_path(:user => @user) %>"
|
|
});
|
|
hideModal();
|
|
return;
|
|
});
|
|
}
|
|
}
|
|
</script> |