|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|