Beispiel #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('account', $account, Config::get('regex.account'))) {
         $response['info'] = '学号格式有误!';
     } elseif (!Safe::checkTry('pwd_email_' . $account)) {
         $response['info'] = '尝试次数过多,临时封禁!';
     } elseif (!($Printer = PrinterModel::where('account', $account)->field('id,email')->find())) {
         $response['info'] = '尚未注册,或者账号错误';
     } elseif (empty($Printer['email'])) {
         $response['info'] = '未绑定邮箱,或邮箱不存在';
     } elseif ($Printer['email'] != $email) {
         $response['info'] = '绑定邮箱不一致,或者邮箱错误';
     } elseif (!Mail::findPwd($email, $code = Random::code(6))) {
         $response['info'] = '邮件发送出错,请联系我们!';
     } else {
         /*发送成功*/
         $find = ['id' => $user['id'], 'account' => $account, 'code' => strtoupper($code)];
         Session::set('find_info_p', $find);
         Safe::del('pwd_email_' . $account);
         $response['status'] = 1;
         $response['info'] = '验证邮件已发送!';
     }
     $this->response = $response;
 }
Beispiel #2
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;
 }