Beispiel #1
0
 public function resetpasswordAction()
 {
     // 请求参数
     $request = $this->getRequest()->getParams();
     if (isset($request['user_id']) && isset($request['key'])) {
         $user_id = $request['user_id'];
         $key = $request['key'];
         $mail = new Application_Model_Log_Mail();
         $m = $mail->fetchRow("user_id = " . $user_id . " and datediff(curdate(), send_time) <= 1", "id desc");
         if ($m) {
             $mm = $m->toArray();
             if ($mm['key'] == '') {
                 echo '<script>alert("链接已使用,请重新提交重置申请获取新链接。");window.location.href="' . HOME_PATH . '/public/home/login"</script>';
                 exit;
             } else {
                 if ($mm['key'] != $key) {
                     echo '<script>alert("链接校验码错误,请重新提交重置申请。");window.location.href="' . HOME_PATH . '/public/home/login"</script>';
                     exit;
                 }
             }
         } else {
             echo '<script>alert("重置密码已过期,请重新提交重置申请。");window.location.href="' . HOME_PATH . '/public/home/login"</script>';
             exit;
         }
     } else {
         $this->_redirect('home/login');
     }
 }