/** * 修改密码提交 * @author huajie <*****@*****.**> */ public function profile() { if (IS_POST) { //获取参数 $uid = $_GET['uid']; // $uid = I('uid'); $password = I('password'); $data['password'] = I('repassword'); empty($password) && $this->error('请输入密码'); empty($data['password']) && $this->error('请输入确认密码'); if ($data['password'] !== $password) { $this->error('您输入的密码与确认密码不一致'); } $Api = new UserApi(); $res = $Api->updatePwd($uid, $data); // var_dump($res);exit(); if ($res['status']) { $this->success('修改密码成功!', U('')); } else { if ($res['info'] < 0) { $message = $this->showRegError($res['info']); $this->error($message); } else { $this->error($res['info']); } } } else { $uid = $_GET['uid']; $this->assign('uid', $uid); $this->display(); } }
public function forget() { if (IS_POST) { $mobile = $_POST['mobile']; $password = $_POST['password']; if (empty($mobile)) { $this->error('请输入手机号码'); } if (empty($password)) { $this->error('请输入新密码'); } $code = session($mobile); if ($code != $_POST['code']) { $this->error('验证码输入错误!'); return; } $user = M('UcenterMember')->where(array('mobile' => $mobile))->find(); if ($user) { $Api = new UserApi(); $data = array('password' => $password); $res = $Api->updatePwd($user['id'], $data); if ($res['status']) { $this->success('密码修改成功!', U('login?goback=1')); } else { $this->error($res['info']); } } else { $this->error('该手机号码不存在'); } } else { $this->pageTitle = "找回密码"; $this->display('forget'); } }