Files
orico-official-website-old/app/index/view/customer/forgetpwd.phtml
2024-10-29 14:04:59 +08:00

473 lines
16 KiB
PHTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{include file="include/head-product" /}
<script type="text/javascript">
var navID = "1";
</script>
</head>
<body>
<!--top End-->
<!-- 新闻详情页 s -->
<body class="bg-gray">
<!-- 注册 -->
<div class="login" style="margin-top:56px;">
<div class="swt-Container">
<div class="login_content_register">
<div class="text-c" style="margin-bottom: 2vw"><img src="/uploads/default/logo-black.png"></div>
<div class="title">
<ul>
<li class="accounts blue cursor_p">手机找回</li>
<li class="short_letter cursor_p">邮箱找回</li>
</ul>
</div>
<div class="content content_01">
<li class="margin-b-7">
<input type="text" tabindex="1" onfocus="hide_err('telephone')" onblur="check_format('telephone')" id="telephone" placeholder="请输入手机号码">
<div id="err_tel"></div>
</li>
<li class="margin-b-7">
<input type="text" tabindex="2" id="captcha1" onfocus="hide_err('captcha1')" placeholder="请输入验证码">
<button class="Obtain" onclick="get_captcha('captcha1')">获取验证码</button>
<div id="err_captcha1"></div>
</li>
<li class="margin-b-5">
<input type="password" tabindex="3" id="password" onfocus="hide_err('password')" onblur="check_format('password')" placeholder="新密码必须包含8-20个字符,且包含数字和字母">
<div id="err_pwd"></div></li>
</li>
<li class="margin-b-5">
<input type="password" tabindex="4" id="re_password" onfocus="hide_err('re_password')" onblur="check_format('re_password')" placeholder="请确认新密码">
<div id="err_repwd"></div>
</li>
<div class="tjdl">
<button class="tjbtn" onclick="update_forget_pwd('update_by_tel')">提交</button>
</div>
</div>
<div class="content content_02" style="display: none;">
<li class="margin-b-7">
<input type="text" onfocus="hide_err('email')" onblur="check_format('email')" id="email" placeholder="请输入邮箱">
<div id="err_email"></div>
</li>
<li class="margin-b-7">
<input onfocus="hide_err('captcha2')" type="text" id="captcha2" placeholder="请输入验证码" >
<button class="Obtain cursor_p" onclick="get_captcha('captcha2')">获取验证码</button>
<div id="err_captcha2"></div>
</li>
<li class="margin-b-5">
<input type="password" id="password2" onfocus="hide_err('password2')" onblur="check_format('password2')" placeholder="新密码必须包含8-20个字符,且包含数字和字母">
<div id="err_pwd2"></div>
</li>
<li class="margin-b-5">
<input type="password" id="re_password2" onfocus="hide_err('re_password2')" onblur="check_format('re_password2')" placeholder="请确认新密码">
<div id="err_repwd2"></div>
</li>
<div class="tjdl">
<button class="tjbtn" onclick="update_forget_pwd('update_by_email')">提交</button>
</div>
</div>
<div class="Register">
<a href="__ORICOROOT__<?php echo url('/register'); ?>" class="left">立即注册</a>
<a href="__ORICOROOT__<?php echo url('/login'); ?>" class="right">登录</a>
</div>
</div>
</div>
</div>
<div class="text-c login_bottom">2015 ORICO Technologies Co.,Ltd 版权所有(<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030702002297" >粤ICP备15025109号-3</a>
<p> <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030702002297" ><img src=""/>粤公网安备 44030702002297号 <img src="__PUBLIC__/web/images/orico_co_icon.png" style="vertical-align: middle;"></a></p>
</div>
<!-- 新闻详情页 e -->
<script type="text/javascript">
$(document).ready(function(){
$(".accounts").click(function(){
hide_err_batch(2);
update_flag = 1;
$(this).siblings().removeClass("blue");
$(this).addClass("blue");
$(".content_02").hide();
$(".content_01").show();
})
$(".short_letter").click(function(){
alert('邮箱暂不可用');
return;
hide_err_batch(1);
update_flag = 2;
$(this).siblings().removeClass("blue");
$(this).addClass("blue");
$(".content_01").hide();
$(".content_02").show();
})
})
</script>
</body>
</html>
<script type="text/javascript">
var update_flag = 1;
var sendsms_flag = 1;
function get_captcha(type)
{
if (type == 'captcha1')
{
var url = '/index/customer/sendsms';
var telephone = $("#telephone").val();
var data = {
telephone: telephone
};
if (sendsms_flag == 0)
{
return;
}
if (!check_format('telephone'))
{
return;
}
}
else if (type == 'captcha2')
{
var url = '/index/customer/sendresetemail';
var email = $("#email").val();
var data = {
email: email
};
if (sendsms_flag == 0)
{
return;
}
if (!check_format('email'))
{
return;
}
}
$.ajax({
url: url,
type: 'post',
dataType: 'json',
data: data,
success: function(data) {
if (data.code == 200) {
//设置button效果开始计时
curCount = 60;
$(".Obtain").attr("disabled", "true");
$(".Obtain").html("重新获取" + curCount + "秒");
InterValObj = window.setInterval(SetRemainTime, 1000);
sendsms_flag = 0;
setTimeout(function() {
sendsms_flag = 1;
}, 60000);
} else {
alert(data.msg);
}
}
});
}
function update_forget_pwd(type) {
if (type == 'update_by_tel')
{
var telephone = $("#telephone").val();
var captcha = $("#captcha1").val();
var password = $("#password").val();
var re_password = $("#re_password").val();
var data = {
telephone: telephone,
captcha: captcha,
password: password
};
if (!check_format('telephone') || !check_format('password') || !check_format('re_password'))
{
return;
}
}
else if (type == 'update_by_email')
{
var email = $("#email").val();
var captcha = $("#captcha2").val();
var password = $("#password2").val();
var re_password = $("#re_password2").val();
var data = {
email: email,
captcha: captcha,
password: password
};
if (!check_format('email') || !check_format('password2') || !check_format('re_password2'))
{
return;
}
}
$.ajax({
url: 'index/customer/update_forget_pwd',
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
if (res.code == 200)
{
alert(res.msg);
location.href = '/login.html';
}
else if (res.code == -3)
{
var html = '<span style="color: red">' + res.msg + '</span>';
show_err('captcha1', html);
}
else if (res.code == -5)
{
var html = '<span style="color: red">' + res.msg + '</span>';
show_err('captcha2', html);
}
else
{
alert(res.msg);
}
}
})
};
function check_format(id)
{
if (id == 'password' || id == 'password2')
{
var flag = id == 'password' ? 1 : 0;
var _id = flag == 1 ? 're_password' : 're_password2';
var err_id = flag == 1 ? 'pwd' : 'pwd2';
var re_password = $("#" + _id).val();
if (re_password != '')
{
check_format(_id);
}
var password = $("#" + id).val();
var arg = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*-.]+$)[a-zA-Z\d!@#$%^&*-.]{8,20}$/;
if (!arg.test(password))
{
var html = '<span style="color: red">密码必须包含8-20个字符,且至少包含两种类型字符</span>';
show_err(err_id, html);
return false;
}
else
{
hide_err(err_id);
return true;
}
}
else if (id == 're_password' || id == 're_password2')
{
var flag = id == 're_password' ? 1 : 0;
var pwd_id = flag == 1 ? 'password' : 'password2';
var err_id = flag == 1 ? 're_pwd' : 're_pwd2';
var password = $("#" + pwd_id).val();
var re_password = $("#" + id).val();
if (password != re_password)
{
var html = '<span style="color: red">两次密码不一致</span>';
show_err(err_id, html);
return false;
}
else
{
hide_err(err_id);
return true;
}
}
else if (id == 'telephone')
{
var telephone = $("#telephone").val();
var arg = /^1[3456789]\d{9}$/;
if (!arg.test(telephone))
{
var html = '<span style="color: red">请检查手机格式</span>';
show_err('telephone', html);
return false;
}
else
{
hide_err('telephone');
return true;
}
}
else if (id == 'email')
{
var email = $("#email").val();
var arg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/;
if (!arg.test(email))
{
var html = '<span style="color: red">邮箱格式错误</span>';
show_err('email', html);
return false;
}
else
{
hide_err('email');
return true;
}
}
}
/*倒数计时*/
function SetRemainTime() {
if (curCount < 1) {
window.clearInterval(InterValObj); //停止计时器
InterValObj = null;
$(".Obtain").removeAttr("disabled"); //启用按钮
$(".Obtain").html("获取短信验证码");
} else {
curCount--;
$(".Obtain").html("重新获取" + curCount + "秒");
}
}
$(document).keyup(function(e) {
var code = e.keyCode;
var type = update_flag == 1 ? 'update_by_tel' : 'update_by_email';
if (code == 13)
{
update_forget_pwd(type);
}
});
</script>
<script type="text/javascript">
function hide_err_batch(id)
{
if (id == 1)
{
hide_err('telephone');
hide_err('captcha1');
hide_err('password');
hide_err('re_password');
}
else
{
}
}
function hide_err(id)
{
if (id == 'password')
{
var err_id = 'err_pwd';
var input_id = 'password';
}
else if (id == 're_password')
{
var err_id = 'err_repwd';
var input_id = 're_password';
}
if (id == 'password2')
{
var err_id = 'err_pwd2';
var input_id = 'password2';
}
else if (id == 're_password2')
{
var err_id = 'err_repwd2';
var input_id = 're_password2';
}
else if (id == 'email')
{
var err_id = 'err_email';
var input_id = 'email';
}
else if (id == 'telephone')
{
var err_id = 'err_tel';
var input_id = 'telephone';
}
else if (id == 'captcha1')
{
var err_id = 'err_captcha1';
var input_id = 'captcha1';
}
else if (id == 'captcha2')
{
var err_id = 'err_captcha2';
var input_id = 'captcha2';
}
$('#' + err_id).html('');
$('#' + input_id).css('border', '1px solid #dedfe0');
}
function show_err(id, html)
{
if (id == 'pwd')
{
var err_id = 'err_pwd';
var input_id = 'password';
}
else if (id == 're_pwd')
{
var err_id = 'err_repwd';
var input_id = 're_password';
}
else if (id == 'pwd2')
{
var err_id = 'err_pwd2';
var input_id = 'password2';
}
else if (id == 're_pwd2')
{
var err_id = 'err_repwd2';
var input_id = 're_password2';
}
else if (id == 'email')
{
var err_id = 'err_email';
var input_id = 'email';
}
else if (id == 'telephone')
{
var err_id = 'err_tel';
var input_id = 'telephone';
}
else if (id == 'captcha1')
{
var err_id = 'err_captcha1';
var input_id = 'captcha1';
}
else if (id == 'captcha2')
{
var err_id = 'err_captcha2';
var input_id = 'captcha2';
}
$('#' + err_id).html(html);
$('#' + input_id).css('border', '1px solid red');
}
/*验证码倒计时*/
function SetRemainTime() {
if (curCount < 1) {
window.clearInterval(InterValObj); //停止计时器
InterValObj = null;
$(".Obtain").removeAttr("disabled"); //启用按钮
$(".Obtain").html("获取短信验证码");
} else {
curCount--;
$(".Obtain").html("重新获取" + curCount + "秒");
}
}
</script>