Hash::check PHP Method

check() public static method

Check the given plain value against a hash.
public static check ( string $value, string $hashedValue, array $options = [] ) : boolean
$value string
$hashedValue string
$options array
return boolean
        public static function check($value, $hashedValue, $options = array())
        {
            return \Illuminate\Hashing\BcryptHasher::check($value, $hashedValue, $options);
        }

Usage Example

コード例 #1
0
 public function login()
 {
     if (Auth::check()) {
         echo json_encode(array('succcess' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '该用户已登录,请不要重复登录'), 'no' => 2));
         exit;
     }
     $account = Input::get('user_email');
     $password = Input::get('user_psw');
     $rememberMe = Input::get('user_remember');
     $captcha = Input::get('user_auth');
     $ip = $this->getIP();
     $codeKey = md5($ip);
     $captchaCode = Cache::tags('register', 'code')->get($codeKey);
     if ($captcha != $captchaCode) {
         echo json_encode(array('success' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '验证码验证失败'), 'no' => 1));
         exit;
     }
     $accountCheck = $this->accountCheck($account);
     if (!is_object($accountCheck)) {
         echo json_encode(array('success' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '用户不存在'), 'no' => 1));
         exit;
     }
     $passwordCheck = Hash::check($password, $accountCheck->user->password);
     if ($passwordCheck) {
         if ($rememberMe == 'true') {
             Auth::login($accountCheck, true);
         } else {
             Auth::login($accountCheck);
         }
     } else {
         echo json_encode(array('succcess' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '密码验证失败'), 'no' => 2));
     }
     echo json_encode(array('success' => true, 'state' => 200, 'nextSrc' => url('usercenter')));
 }
All Usage Examples Of Hash::check