Exemplo n.º 1
0
 /**
  * Check nonce against app.key
  *
  * @param null|string $nonce By default will use 'nonce' index
  * @param null|string $value By default will get app.key
  * @param null|string $message By default try to get translation on ajax.invalid
  * @param null|mixed $data
  */
 public function validate($nonce = null, $value = null, $message = null, $data = null)
 {
     $nonce = $nonce ? $nonce : Request::get('nonce');
     $value = $value ? $value : config('app.key');
     if (!wp_verify_nonce($nonce, $value)) {
         $default = 'AJAX is invalid.';
         $data = $data ? $data : Request::except(['nonce', 'action']);
         wp_send_json(['error' => true, 'msg' => $message ? $message : $default, 'data' => $data]);
     }
 }
Exemplo n.º 2
0
 /**
  * Return the password value from the credentials
  *
  * @param array $credentials
  * @return mixed
  */
 protected function getPasswordCredential($credentials = array())
 {
     $passField = config('auth.credentials.password');
     if (isset($credentials[$passField])) {
         return $credentials[$passField];
     } else {
         if (Input::has($passField)) {
             return Input::get($passField);
         } else {
             if (isset($credentials['user_password'])) {
                 return $credentials['user_password'];
             } else {
                 if (isset($credentials['pwd'])) {
                     return $credentials['pwd'];
                 }
             }
         }
     }
     throw new InvalidArgumentException("Password field not found");
 }