master
yulingwei 5 years ago
parent 55a6b20f6e
commit bd166bb5eb

@ -19,12 +19,19 @@ class SafeController extends BaseController{
public function setSafeIndex() {
$id = get_pid();
$safePwd = M('promote','tab_')->where(['id'=>$id])->field('second_pwd')->find();
if(empty($safePwd['second_pwd'])) {
return $this->display();
}else {
return $this->display("verifySafePwd");
$safePwd = M('promote','tab_')->where(['id'=>$id])->field('second_pwd, level, login_phone')->find();
if(!empty($safePwd['login_phone'])) {
$this->assign('login_phone', $safePwd['login_phone']);
}
if ($safePwd['level'] != 1) {
return $this->error('非会长无法更改');
}
return $this->display();
// if(empty($safePwd['second_pwd'])) {
// return $this->display();
// }else {
// return $this->display("verifySafePwd");
// }
}
@ -78,30 +85,36 @@ class SafeController extends BaseController{
}
public function modifyPwdIndex() {
$id = get_pid();
$promote = M('promote', 'tab_')->where(['id' => $id])->find();
if(!empty($promote['login_phone'])) {
$this->assign('login_phone', $promote['login_phone']);
}
if($_POST) {
$oldpwd = $_POST['oldpwd'];
$safepwd = $_POST['safepwd'];
if(empty($oldpwd)) {
$this->error("旧密码不能为空");
if ($promote['level'] != 1) {
return $this->error('修改失败,非会长无法修改!');
}
//$oldpwd = $_POST['oldpwd'];
$safepwd = $_POST['safepwd'];
// if(empty($oldpwd)) {
// $this->error("旧密码不能为空");
// }
if(empty($safepwd)) {
$this->error("安全密码不能为空");
}
$id = get_pid();
$safePwd = M('promote','tab_')->where(['id'=>$id])->field('second_pwd')->find();
if($safePwd['second_pwd'] == $this->think_ucenter_md5($oldpwd, UC_AUTH_KEY)){
$data['second_pwd'] = $this->think_ucenter_md5($safepwd, UC_AUTH_KEY);
$updateRs = M("promote","tab_")->where(['id'=>$id])->save($data);
if($updateRs) {
$this->success("修改成功");
}else {
$this->error("修改失败,请重新操作");
}
if (!$this->checksafecode($promote['login_phone'], $_POST['code'])) {
return $this->error('验证码错误');
}
else {
$this->error('旧密码错误,请确认');
$id = get_pid();
$data['second_pwd'] = $this->think_ucenter_md5($safepwd, UC_AUTH_KEY);
$updateRs = M("promote","tab_")->where(['id'=>$id])->save($data);
if($updateRs) {
$this->success("修改成功");
}else {
$this->error("修改失败,请重新操作");
}
}
$this->display();
}

@ -44,17 +44,26 @@
<span style="margin-top:50px;font-size:15px;color:#26c7db85">为了保证您的账户安全,提现和转账等操作需要使用安全密码进行确认(请不要和登陆密码一样)</span>
<form action="{:U('Safe/modifypwdindex')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:30px;margin-left:50px" >
<tr>
<!-- <tr>
<td class="l">旧密码:</td>
<td class="r"><input type="password" class="input txt" name="oldpwd" id="oldpwd" style="width:430px" placeholder="旧密码">
<span id="confirm_password_tip"></span></td>
</tr>
</tr> -->
<tr>
<td class="l">安全密码:</td>
<td class="l">安全密码:</td>
<td class="r"><input type="password" class="input txt" name="safepwd" id="confirm_password" style="width:430px" placeholder="请输入要设置的安全密码">
<span id="confirm_password_tip"></span></td>
</tr>
<tr>
<td class="l"><span style="color:red">*</span>短信验证码</td>
<input type="hidden" value="{$login_phone}" id="login_phone">
<td class="r"><input type="text" class="input txt" name="code" id="code" style="width:230px" placeholder="请输入短信验证码">
<span id="confirm_password_tip"></span>
<input id="sendtelCode" readonly onfocus="this.blur()" class="tj btn ajax-post" value="发送验证码" style="padding-left:40px;width:120px;margin-left:20px" title="" target-form="paw_info">
</td>
</tr>
<tr>
<td class="l"></td>
@ -207,5 +216,53 @@
_reset_area('','','');
});
</script>
<script>
$('#sendtelCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = $.trim($('#login_phone').val());
//console.log(phone);return;
if (phone == '') {
alert("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
if (i>0) {
var r = 60;
e='#sendSasfeCode';
$(e).removeClass('g-btn').addClass('g-btntn');
var a = setInterval(function() {
r--;
$(e).text(r + '秒');
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'),
$(e).text('获取验证码'),
clearInterval(a))
},1000)
}
};
});
</script>
</block>

@ -37,24 +37,32 @@
<div class="page-list normal_list promote-base_info-form">
<div class="trunk-title">
<img src="__IMG__/20180207/icon_normal_zhanghu.png">
<span class="title_main">设置安全密码</span>
<span class="title_main">修改安全密码</span>
</div>
<div class="trunk-content article">
<div class="trunk-list baseInfo">
<form action="{:U('Safe/setSafePassword')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:50px;margin-left:50px">
<tr>
<td class="l">新密码:</td>
<td class="r"><input type="password" class="input txt" name="password" id="password" style="width:430px" placeholder="新密码">
<span id="password_tip"></span></td>
<span style="margin-top:50px;font-size:15px;color:#26c7db85">为了保证您的账户安全,提现和转账等操作需要使用安全密码进行确认(请不要和登陆密码一样)</span>
<form action="{:U('Safe/modifypwdindex')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:30px;margin-left:50px" >
<!-- <tr>
<td class="l">旧密码:</td>
<td class="r"><input type="password" class="input txt" name="oldpwd" id="oldpwd" style="width:430px" placeholder="旧密码">
<span id="confirm_password_tip"></span></td>
</tr> -->
<tr>
<td class="l">新安全密码:</td>
<td class="r"><input type="password" class="input txt" name="safepwd" id="confirm_password" style="width:430px" placeholder="请输入要设置的安全密码">
<span id="confirm_password_tip"></span></td>
</tr>
<tr>
<td class="l">确认密码:</td>
<td class="r"><input type="password" class="input txt" name="confirm_password" id="confirm_password" style="width:430px" placeholder="确认密码">
<span id="confirm_password_tip"></span></td>
<td class="l"><span style="color:red">*</span>短信验证码</td>
<input type="hidden" value="{$login_phone}" id="login_phone">
<td class="r"><input type="text" class="input txt" name="code" id="code" style="width:230px" placeholder="请输入短信验证码">
<span id="confirm_password_tip"></span>
<input id="sendtelCode" readonly onfocus="this.blur()" class="tj btn ajax-post" value="发送验证码" style="padding-left:40px;width:120px;margin-left:20px" title="" target-form="paw_info">
</td>
</tr>
<tr>
@ -208,5 +216,53 @@
_reset_area('','','');
});
</script>
<script>
$('#sendtelCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = $.trim($('#login_phone').val());
//console.log(phone);return;
if (phone == '') {
alert("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
if (i>0) {
var r = 60;
e='#sendSasfeCode';
$(e).removeClass('g-btn').addClass('g-btntn');
var a = setInterval(function() {
r--;
$(e).text(r + '秒');
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'),
$(e).text('获取验证码'),
clearInterval(a))
},1000)
}
};
});
</script>
</block>
Loading…
Cancel
Save