Esempio n. 1
0
 /**
  * 通过邮箱找回密码
  * @method POST_emailAction
  * @author NewFuture
  */
 public function POST_emailAction()
 {
     $response['status'] = 0;
     if (!Input::post('email', $email, 'email')) {
         $response['info'] = '邮箱格式有误或者不支持!';
     } elseif (!Input::post('number', $number, 'card')) {
         $response['info'] = '学号格式有误!';
     } elseif (!Safe::checkTry('pwd_email_' . $number)) {
         $response['info'] = '尝试次数过多,临时封禁!';
     } elseif (!($user = UserModel::where('number', $number)->field('id,name,email')->find())) {
         $response['info'] = '尚未注册,或者学号错误';
     } elseif (empty($user['email'])) {
         $response['info'] = '未绑定邮箱,或者学号错误';
     } elseif (Encrypt::decryptEmail($user['email']) != $email) {
         $response['info'] = '绑定邮箱不一致,或者邮箱错误';
     } elseif (!Mail::findPwd($email, $code = Random::code(6), $user['name'])) {
         $response['info'] = '邮件发送出错,请联系我们!';
     } else {
         /*发送成功*/
         $findPwd = ['id' => $user['id'], 'number' => $number, 'code' => strtoupper($code)];
         Session::set('find_info', $findPwd);
         Safe::del('pwd_email_' . $number);
         $response['status'] = 1;
         $response['info'] = '找回验证码已发送到' . $email;
     }
     $this->response = $response;
 }
Esempio n. 2
0
 /**
  * 获取用户真实手机
  * GET /user/1/email
  * @method GET_infoAction
  * @param  integer        $id [description]
  * @author NewFuture
  */
 public function GET_emailAction($id = 0)
 {
     $pid = $this->authPrinter();
     if (TaskModel::where('use_id', $id)->where('pri_id', $pid)->get('id')) {
         $email = UserModel::where('id', '=', $id)->get('email');
         $email = $email ? Encrypt::decryptEmail($email) : null;
         $this->response(1, $email);
     } else {
         $this->response(0, '此同学未在此打印过');
     }
 }
Esempio n. 3
0
 /**
  * 获取用户真实手机
  * GET /user/1/email
  * @method GET_infoAction
  * @param  integer        $id [description]
  * @author NewFuture
  */
 public function GET_emailAction($id = 0)
 {
     $id = $this->auth($id);
     $email = UserModel::where('id', '=', $id)->get('email');
     $email = $email ? Encrypt::decryptEmail($email) : null;
     $this->response(1, $email);
 }
Esempio n. 4
0
 /**
  * 用户数据解码
  * @method mask
  * @param  [type] &$user [description]
  * @return [type]        [description]
  * @author NewFuture
  */
 public static function decrypt(&$user)
 {
     if (isset($user['phone']) && $user['phone'] && $user['number'] && $user['id']) {
         $user['phone'] = Encrypt::decryptPhone($user['phone'], $user['number'], $user['id']);
     }
     if (isset($user['email']) && ($email = $user['email'])) {
         $user['email'] = Encrypt::decryptEmail($email);
     }
     return $user;
 }