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

185 lines
5.6 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" /}
<script type="text/javascript">
var navID = "1";
</script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/m_weben/css/login.css">
</head>
<body>
<!--top-->
<div id="content">
{include file="include/top" /}
<div class="img-responsive margin-top-90"><img src="/frontend/m_web/images/user/login_banner.jpg" alt=""></div>
<!--top End-->
<!-- 登录 -->
<div class="margin-top-30">
<div class="login-m-a">
<div class="login-m-user">
<div class="login-m-img"><img src="/frontend/m_web/images/user/password.png" alt=""></div>
<div class="input-a">
<input type="password" id="password" onfocus="this.placeholder=''" onblur="this.placeholder='New password'" placeholder="New password">
</div>
</div>
</div>
<div class="login-m-a ">
<div class="login-m-password">
<div class="login-m-img"><img src="/frontend/m_web/images/user/password.png" alt=""></div>
<div class="input-a">
<input type="password" id="re_password" onfocus="this.placeholder=''" onblur="this.placeholder='Confirm New Password'" placeholder="Confirm New Password">
</div>
</div>
</div>
</div>
<!--登录按钮-->
<div class="login-btn margin-top-70">
<button class="login" onclick="update_forget_pwd()">Sumbit</button>
</div>
<!--快速注册-->
<div class="login-text">
<a href="__ORICOROOT__<?php echo url('/customer/register'); ?>">Registry</a>
<span class="floa_r"><a href="__ORICOROOT__<?php echo url('/customer/login.html'); ?>">Login</a></span>
</div>
{include file="include/bottom" /}
</div>
</html>
<script type="text/javascript">
function update_forget_pwd() {
var password = $("#password").val();
var re_password = $("#re_password").val();
var token = '<?php echo isset($token) ? $token : ''; ?>';
var data = {
token: token,
password: password
};
if (!check_format('password') || !check_format('re_password'))
{
return;
}
$.ajax({
url: '/usmobile/customer/change_password',
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
if (res.code == 200)
{
alert(res.msg);
location.href = '/usmobile/customer/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')
{
var re_password = $("#re_password").val();
if (re_password != '')
{
check_format('re_password');
}
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">The password must contain 8-20 characters and at least two types of characters.</span>';
show_err('password', html);
return false;
}
else
{
hide_err('password');
return true;
}
}
else if (id == 're_password')
{
var password = $("#password").val();
var re_password = $("#re_password").val();
if (password != re_password)
{
var html = '<span style="color: red"> Two password inconsistencies </span>';
show_err('re_password', html);
return false;
}
else
{
hide_err('re_password');
return true;
}
}
}
$(document).keyup(function(e) {
var code = e.keyCode;
if (code == 13)
{
update_forget_pwd();
}
});
</script>
<script type="text/javascript">
function hide_err(id)
{
if (id == 'password')
{
var err_id = 'err_password';
var input_id = 'password';
}
else if (id == 're_password')
{
var err_id = 'err_re_password';
var input_id = 're_password';
}
$('#' + err_id).html('');
$('#' + input_id).css('border', '1px solid #dedfe0');
}
function show_err(id, html)
{
if (id == 'password')
{
var err_id = 'err_password';
var input_id = 'password';
}
else if (id == 're_password')
{
var err_id = 'err_re_password';
var input_id = 're_password';
}
$('#' + err_id).html(html);
$('#' + input_id).css('border', '1px solid red');
}
</script>