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

233 lines
6.5 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">
<title>My Center</title>
{include file="include/head-product" /}
</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>
<div class="swt-Container">
<div class="people">
<div class="people_title">
<ul>
<a href="__ORICOROOT__/customer/personal.html"><li class="people_blue">Manage Your Account</li></a>
<a href="__ORICOROOT__/customer/my_collection.html"><li>Favorite</li></a>
</ul>
</div>
<div class="content01">
<?php if (!empty($customer_info)): ?>
<?php
$head_img = $customer_info['picture'] != '' ? $customer_info['picture'] : '__PUBLIC__/web/images/customer/logo_small_03.png';
?>
<div class="people_logo">
<div class="left"><img style="border-radius: 50%;" src="<?php echo $head_img; ?>"></div>
<div class="right">
<div>User<?php echo $customer_info['firstname']; ?></div>
<!--<div class="">修改个人信息</div>-->
</div>
</div>
<?php endif; ?>
<div class="people_AC">
<div class="title"><span class="text-l">Account Security</span></div>
<?php if (!empty($customer_info)): ?>
<ul>
<li>
<div class="u_before">
<div class="left">Password</div>
<div class="right cursor_p">Change Password</div>
</div>
<div class="u_after b_bottom" style="display: none;">
<?php if ($customer_info['have_pwd']): ?>
<div class="m-bottom">
<label>Original Password</label>
<input id="old_password" onfocus="hide_err('old_password')" class="form-control input_class" type="password">
<div id="err_old_password" style="color: red"></div>
</div>
<?php endif; ?>
<div class="m-bottom">
<label>New Password</label>
<input onfocus="hide_err('new_password')" onblur="check_format('new_password')" id="new_password" class="form-control input_class" type="password">
<div id="err_new_password" style="color: red"></div>
</div>
<div class="m-bottom">
<label>Confirm Password</label>
<input onfocus="hide_err('re_password')" onblur="check_format('re_password')" id="re_password" class="form-control input_class" type="password">
<div id="err_re_password" style="color: red"></div>
</div>
<div class="u_button">
<a class="u_button_blue" onclick="update_pwd()">Confirm</a>
<a class="u_button_gray">Cancel</a>
<a href="__ORICOROOT__/customer/retrieve_password.html">
<span class="forget_button f_blue">Forget Password</span>
</a>
</div>
</div>
</li>
</ul>
</div>
<?php endif; ?>
</div>
</div>
</div>
<script type="application/javascript">
/*修改*/
$(document).ready(function(){
$(".u_before .right").click(function(){
$(this).parents(".u_before").hide();
$(this).parents(".u_before").next().show();
})
$(".u_after .u_button_gray").click(function(){
$(this).parents(".u_after").hide();
$(this).parents(".u_after").prev().show();
})
})
/*批量管理*/
$(document).ready(function(){
$(".u_admin01 .Batch").click(function(){
$(".u_admin01").hide();
$(".u_admin02").show();
$(".u_product .check_B").html('<div class="check_B position-a"><input id="" type="checkbox" class="check_box"><label></label></div>');
});
$(".u_admin02 .cancel").click(function(){
$(".u_admin02").hide();
$(".u_admin01").show();
$(".u_product .check_B").html('');
});
})
/*全选*/
$(document).ready(function(){
$(".u_admin02 input[name='check']").click(function(){
if($(this).is(":checked")){
$(".u_product input[type='checkbox']").prop("checked",true);
}else{
$(".u_product input[type='checkbox']").prop("checked",false);
}
})
});
</script>
<!-- bottom s -->
{include file="include/bottom" /}
<!-- bottom e -->
</body>
</html>
<script type="text/javascript">
function check_format(id)
{
if (id == 'new_password')
{
var re_password = $("#re_password").val();
if (re_password != '')
{
check_format('re_password');
}
var password = $("#new_password").val();
var arg = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*-.]+$)[a-zA-Z\d!@#$%^&*-.]{8,20}$/;
if (!arg.test(password))
{
var html = 'The password must contain 8-20 characters and at least two types of characters.';
show_err('new_password', html);
return false;
}
else
{
hide_err('new_password');
return true;
}
}
else if (id == 're_password')
{
var password = $("#new_password").val();
var re_password = $("#re_password").val();
if (password != re_password)
{
var html = 'Two password inconsistencies';
show_err('re_password', html);
return false;
}
else
{
hide_err('re_password');
return true;
}
}
}
function update_pwd()
{
var old_password = $("#old_password").val();
var password = $("#new_password").val();
var data = {
old_password: old_password,
password: password,
};
if (!check_format('new_password') || !check_format('re_password'))
{
return;
}
$.ajax({
url: '/us/customer/update_pwd',
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
if (res.code == 200)
{
alert(res.msg);
location.reload();
}
else if (res.code == -2)
{
var html = res.msg;
show_err('old_password', html);
}
else
{
alert(res.msg);
}
}
});
}
</script>
<script type="text/javascript">
function show_err(id, html)
{
var err_id = '#err_' + id;
var input_id = '#' + id;
$(err_id).html(html);
$(input_id).css('border', '1px solid red');
}
function hide_err(id)
{
var err_id = '#err_' + id;
var input_id = '#' + id;
$(err_id).html('');
$(input_id).css('border', '1px solid #dedfe0');
}
</script>