validate() public method

Checks the steam login
public validate ( ) : boolean
return boolean
Beispiel #1
0
 public function getLogin()
 {
     if ($this->steam->validate()) {
         $info = $this->steam->getUserInfo();
         if (!is_null($info)) {
             try {
                 $user = User::where('steamid', $info->getSteamID())->first();
                 if (is_null($user)) {
                     $user = new User();
                     $user->name = $info->getNick();
                     $user->steamid = $info->getSteamID();
                     $user->profileURL = $info->getProfileURL();
                     $user->save();
                 }
                 if ($user->name != $info->getNick() || $user->profileURL != $info->getProfileURL()) {
                     $user->name = $info->getNick();
                     $user->profileURL = $info->getProfileURL();
                     $user->save();
                 }
                 Auth::login($user);
                 return Redirect::to('/');
             } catch (Illuminate\Database\Eloquent\ModelNotFoundException $ex) {
             }
         }
     } else {
         return $this->steam->redirect();
         //redirect to steam login page
     }
 }