public function login()
 {
     $response = $this->steam->validate();
     Log::alert(json_encode($this->steam));
     Log::alert(json_encode(\Config::get('steam-auth.api_key')));
     if ($response) {
         $info = $this->steam->getUserInfo();
         if (!is_null($info)) {
             $user = User::where('steam_id', $info->getSteamID64())->first();
             if (!is_null($user)) {
                 Auth::login($user, true);
                 return redirect('/');
                 // redirect to site
             } else {
                 $data = ['name' => $info->getNick(), 'steam_id' => $info->getSteamID64(), 'avatar' => $info->getProfilePictureFull()];
                 $user = User::create($data);
                 Auth::login($user, true);
                 return redirect('/');
                 // redirect to site
             }
         }
     } else {
         return $this->steam->redirect();
         // redirect to Steam login page
     }
 }
 /**
  *  Register the permissions.
  *
  * @return bool
  */
 public function registerPermissions()
 {
     try {
         $this->getPermissions()->map(function ($permission) {
             $this->gate->define($permission->name, function ($user) use($permission) {
                 return $user->hasPermissionTo($permission);
             });
         });
         return true;
     } catch (Exception $e) {
         Log::alert('Could not register permissions');
         return false;
     }
 }
Esempio n. 3
0
 /**
  * Remove o usuário do aplicativo.
  * @param $id
  */
 public function destroy($id)
 {
     if ($id == null) {
         abort(404);
     }
     $user = User::find($id);
     if ($user->destroy($user->id)) {
         unlink($user->avatar);
     }
     Log::alert("A conta do usuário {$user->name} foi excluida");
     toast()->success("Conta excluida!");
     return redirect()->to('/auth/login');
 }
Esempio n. 4
0
 /**
  * Action must be taken immediately.
  *
  * Example: Entire website down, database unavailable, etc. This should
  * trigger the SMS alerts and wake you up.
  *
  * @param string $message
  * @param array $context
  *
  * @return bool
  */
 public function alert($message, array $context = [])
 {
     return Log::alert($message, $context);
 }
Esempio n. 5
0
 /**
  * @param        $data
  * @param array  $contextualData
  * @param array  $location
  */
 public static function alert($data, array $location = [], array $contextualData = [])
 {
     $msg = self::renderMessage($data, $location);
     /** @noinspection PhpUndefinedMethodInspection */
     BaseLog::alert($msg, $contextualData);
 }