init
This commit is contained in:
185
app/id/view/customer/forgetpwd.phtml
Executable file
185
app/id/view/customer/forgetpwd.phtml
Executable file
@@ -0,0 +1,185 @@
|
||||
<!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-->
|
||||
<header class="header-PC header-Product">
|
||||
<div id="header" class="theme-black">
|
||||
{include file="include/top" /}
|
||||
{include file="include/top-header" /}
|
||||
</div>
|
||||
</header>
|
||||
{include file="include/top-header-mobile" /}
|
||||
|
||||
<!--top End-->
|
||||
|
||||
<!-- 新闻详情页 s -->
|
||||
<div class="zhuce1">
|
||||
<div class="w1200">
|
||||
<form action="" method="post" id="forget-form">
|
||||
<div class="zctit">
|
||||
<a href="<?php echo url('/us/forgetpwd'); ?>" class="zca1">Find password</a>
|
||||
<a href="<?php echo url('/us/register'); ?>" class="zca2">Has no account/Sign in </a>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<ul class="w1000 zclist zclist1 zhlist">
|
||||
<li>
|
||||
<span class="zctext1 zhpass">E-mail:</span>
|
||||
<input type="text" name="email" value="" id="email">
|
||||
<a href="javascript:;" class="zhyzm" id="nbtn">Send Captcha</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="zctext1 zhpass">Enter Captcha:</span>
|
||||
<input type="text" name="code" value="" id="code">
|
||||
<i class="zhdot"></i>
|
||||
</li>
|
||||
<li>
|
||||
<span class="zctext1 zhpass">New Password:</span>
|
||||
<input type="password" name="password" value="" id="password">
|
||||
<i class="zhdot"></i>
|
||||
</li>
|
||||
<li>
|
||||
<span class="zctext1 zhpass">Confirm New Password:</span>
|
||||
<input type="password" name="repassword" value="" id="repassword">
|
||||
<i class="zhdot"></i>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tjcon zhcon">
|
||||
<a href="javascript:void(0);" class="tjbtn zhbtn" id="submit-btn">Done</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 新闻详情页 e -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var InterValObj; //timer变量,控制时间
|
||||
var curCount; //当前剩余秒数
|
||||
$(function() {
|
||||
$('#forget-form').bind('submit', function(event) {
|
||||
var emailObj = document.getElementById('email');
|
||||
if (isNull(emailObj.value) || !validEmail(emailObj.value)) {
|
||||
alert('Please enter a valid E-mail address');
|
||||
emailObj.focus();
|
||||
return false;
|
||||
}
|
||||
var codeObj = document.getElementById('code');
|
||||
if (isNull(codeObj.value) || codeObj.value.length != 5) {
|
||||
alert('The captcha is required');
|
||||
codeObj.focus();
|
||||
return false;
|
||||
}
|
||||
var passwordObj = document.getElementById('password');
|
||||
if (isNull(passwordObj.value) || passwordObj.value.length < 6) {
|
||||
alert('Please enter user password at least 6 characters');
|
||||
passwordObj.focus();
|
||||
return false;
|
||||
}
|
||||
var repasswordObj = document.getElementById('repassword');
|
||||
if (isNull(repasswordObj.value) || repasswordObj.value.length < 6) {
|
||||
alert('Please enter confirmed password at least 6 characters');
|
||||
repasswordObj.focus();
|
||||
return false;
|
||||
}
|
||||
if (repasswordObj.value !== passwordObj.value) {
|
||||
repasswordObj.focus();
|
||||
alert('User password should be consistent with the confirmed password');
|
||||
return false;
|
||||
}
|
||||
var options = {
|
||||
type: "post",
|
||||
cache: false,
|
||||
dataType: "json",
|
||||
data: $(this).serialize(),
|
||||
success: function(data) {
|
||||
if (data.code) {
|
||||
//alert(data.msg);
|
||||
location.href = data.url;
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
//alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
};
|
||||
$.ajax(options);
|
||||
return false;
|
||||
});
|
||||
$("a#submit-btn").click(function(event) {
|
||||
event.preventDefault();
|
||||
$('#forget-form').submit();
|
||||
});
|
||||
$("a#nbtn").click(function(event) {
|
||||
event.preventDefault();
|
||||
var emailObj = document.getElementById('email');
|
||||
if (isNull(emailObj.value) && !validEmail(emailObj.value)) {
|
||||
alert('Please enter a valid E-mail address');
|
||||
emailObj.focus();
|
||||
return false;
|
||||
}
|
||||
if (InterValObj) {
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo url('/index/customer/sendresetemail'); ?>',
|
||||
data: {email: emailObj.value},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (data.code) {
|
||||
//设置button效果,开始计时
|
||||
curCount = 60;
|
||||
$("a#nbtn").css("background-color", "LightSkyBlue");
|
||||
$("a#nbtn").attr("disabled", "true");
|
||||
$("a#nbtn").html("Get captcha" + curCount + "S");
|
||||
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
|
||||
alert(data.msg);
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function SetRemainTime() {
|
||||
if (curCount < 1) {
|
||||
window.clearInterval(InterValObj); //停止计时器
|
||||
InterValObj = null;
|
||||
$("a#nbtn").removeAttr("disabled"); //启用按钮
|
||||
$("a#nbtn").css("background-color", "");
|
||||
$("a#nbtn").html("Send Captcha");
|
||||
} else {
|
||||
curCount--;
|
||||
$("a#nbtn").html("Get captcha" + curCount + "S");
|
||||
}
|
||||
}
|
||||
function isNull(data) {
|
||||
return (data == "" || data == undefined || data == null) ? true : false;
|
||||
}
|
||||
function trim(str) {
|
||||
return str.replace(/(^\s*)|(\s*$)/g, '');
|
||||
}
|
||||
function isTelephone(value) {
|
||||
var isMobile = /^1[345789]\d{9}$/;
|
||||
return isMobile.test(value);
|
||||
}
|
||||
function validEmail(email) {
|
||||
//对电子邮件的验证
|
||||
var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
|
||||
return reg.test(email);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!-- bottom s -->
|
||||
{include file="include/bottom" /}
|
||||
<!-- bottom e -->
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user