Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     /**
  2.      * Retrieve a user by the given credentials.
  3.      *
  4.      * @param  array  $credentials
  5.      * @return \Illuminate\Contracts\Auth\Authenticatable|null
  6.      *
  7.         ** this one sorta dupulicates validate but it works.....
  8.      */
  9.     public function retrieveByCredentials(array $credentials) {
  10.         $api = new IgnitionapiController();
  11.         $data = [ "function" => "login_user", "username" => $credentials['username'], "password" => $credentials['password'], "ordertype"=> config('services.ignitionapi.ignition_api_vas_type')];
  12.         $res = $api->process_api_response($api->process_api($data));
  13.         if($res['success'] && isset($res['success'])) {
  14.             return  new ignitionUser();//tried adding stuff to object here didn't work
  15.         }
  16.         return null;
  17.     }
  18.  
  19.     /**
  20.      * Validate a user against the given credentials.
  21.      *
  22.      * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  23.      * @param  array  $credentials
  24.      * @return bool
  25.      */
  26.     public function validateCredentials(\Illuminate\Contracts\Auth\Authenticatable $user, array $credentials) {
  27.         $api = new IgnitionapiController();
  28.         $data = [ "function" => "login_user", "username" => $credentials['username'], "password" => $credentials['password'], "ordertype"=> config('services.ignitionapi.ignition_api_vas_type')];
  29.         $res = $api->process_api_response($api->process_api($data));
  30.         if($res['success'] && isset($res['success'])) {
  31.             $user->name = $credentials['username'];
  32.             $user->email = (isset($credentials['email']) ? $credentials['email'] : '' );
  33.             return true;
  34.         }else{
  35.             return false;
  36.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement