Beispiel #1
0
 /**
  * [resetEmailAction 重置邮箱]
  * @return [type] [1 修改成功,10015 该邮件已存在,10031 非法操作]
  */
 public function resetEmailAction()
 {
     if (empty($this->session->get('emailToken'))) {
         echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10031']))));
     }
     if (!$this->validFlag) {
         echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
     } else {
         $user = new User();
         $res = $user->isEmailExist($this->_sanReq['email']);
         if ($res['u_email']) {
             echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10015']))));
         } else {
             $res = $user->resetEmail($this->session->get('uid'), $this->_sanReq['email']);
             if ($res) {
                 $Service = new Service($this->di);
                 $Service->sendMails($this->session->get('uid'), $this->_sanReq['email']);
                 $this->session->remove('emailToken');
                 echo json_encode(array('ret' => 1));
             }
         }
     }
     exit;
 }