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

186 lines
8.8 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-->
<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="__ORICOROOT__<?php echo url('/forgetpwd'); ?>" class="zca1">Find password</a>
<a href="__ORICOROOT__<?php echo url('/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: '__ORICOROOT__<?php echo url('/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>