diff options
author | Camil Staps | 2015-05-12 22:44:16 +0200 |
---|---|---|
committer | Camil Staps | 2015-05-12 22:44:16 +0200 |
commit | a0bb2d17c662231ab45ab3910d6a8cafc01bd203 (patch) | |
tree | f72b9e7b99111030d1f21982a8d11953ce98a6dc /src | |
parent | Access-control-allow-{methods,headers} headers (diff) |
Cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php | 9 | ||||
-rw-r--r-- | src/CamilStaps/BotleaguesApi/Exception/LoginException.php | 5 | ||||
-rw-r--r-- | src/CamilStaps/BotleaguesApi/Exception/RedirectException.php | 5 | ||||
-rw-r--r-- | src/CamilStaps/BotleaguesApi/TokenAuthenticationProvider.php | 3 | ||||
-rw-r--r-- | src/CamilStaps/BotleaguesApi/User.php | 8 | ||||
-rw-r--r-- | src/controllers/CompetitionController.php | 2 | ||||
-rw-r--r-- | src/controllers/CompetitionTypeController.php | 2 | ||||
-rw-r--r-- | src/controllers/GameController.php | 2 | ||||
-rw-r--r-- | src/controllers/ParticipantController.php | 2 | ||||
-rw-r--r-- | src/controllers/UserController.php | 16 | ||||
-rw-r--r-- | src/controllers/UserTokenController.php | 2 | ||||
-rw-r--r-- | src/routes.php | 3 |
12 files changed, 13 insertions, 46 deletions
diff --git a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php index 9914208..3cf6e12 100644 --- a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php +++ b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php @@ -85,15 +85,6 @@ class BotleaguesApiServiceProvider extends ServiceProvider { ], 500); }); - - API::error(function(Exception\LoginException $e) { - $response = Response::make("Please login", 401); - $response->header('WWW-Authenticate', 'Basic realm="Please login"'); - return $response; - }); - API::error(function(Exception\RedirectException $e) { - return Redirect::to($e->getMessage()); - }); API::error(function(\Exception $e) { return Response::make( diff --git a/src/CamilStaps/BotleaguesApi/Exception/LoginException.php b/src/CamilStaps/BotleaguesApi/Exception/LoginException.php deleted file mode 100644 index 122d190..0000000 --- a/src/CamilStaps/BotleaguesApi/Exception/LoginException.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php -namespace CamilStaps\BotleaguesApi\Exception; - -class LoginException extends \Exception { -}
\ No newline at end of file diff --git a/src/CamilStaps/BotleaguesApi/Exception/RedirectException.php b/src/CamilStaps/BotleaguesApi/Exception/RedirectException.php deleted file mode 100644 index 12d64b5..0000000 --- a/src/CamilStaps/BotleaguesApi/Exception/RedirectException.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php -namespace CamilStaps\BotleaguesApi\Exception; - -class RedirectException extends \Exception { -}
\ No newline at end of file diff --git a/src/CamilStaps/BotleaguesApi/TokenAuthenticationProvider.php b/src/CamilStaps/BotleaguesApi/TokenAuthenticationProvider.php index f3dad6e..053f837 100644 --- a/src/CamilStaps/BotleaguesApi/TokenAuthenticationProvider.php +++ b/src/CamilStaps/BotleaguesApi/TokenAuthenticationProvider.php @@ -43,8 +43,7 @@ class TokenAuthenticationProvider implements ProviderInterface { * * @return string */ - public function getAuthorizationMethod() - { + public function getAuthorizationMethod() { return 'token'; } }
\ No newline at end of file diff --git a/src/CamilStaps/BotleaguesApi/User.php b/src/CamilStaps/BotleaguesApi/User.php index 39b42dc..220db36 100644 --- a/src/CamilStaps/BotleaguesApi/User.php +++ b/src/CamilStaps/BotleaguesApi/User.php @@ -29,7 +29,7 @@ class User extends Model implements UserInterface { /** * Get the password for the user. - * + * @todo not implemented yet * @return string */ public function getAuthPassword() { @@ -38,7 +38,7 @@ class User extends Model implements UserInterface { /** * Get the token value for the "remember me" session. - * + * @todo not implemented yet * @return string */ public function getRememberToken() { @@ -47,7 +47,7 @@ class User extends Model implements UserInterface { /** * Set the token value for the "remember me" session. - * + * @todo not implemented yet * @param string $value * @return void */ @@ -57,7 +57,7 @@ class User extends Model implements UserInterface { /** * Get the column name for the "remember me" token. - * + * @todo not implemented yet * @return string */ public function getRememberTokenName() { diff --git a/src/controllers/CompetitionController.php b/src/controllers/CompetitionController.php index 6529433..c169492 100644 --- a/src/controllers/CompetitionController.php +++ b/src/controllers/CompetitionController.php @@ -29,7 +29,7 @@ class CompetitionController extends BaseController { if ($this->competition->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/CompetitionTypeController.php b/src/controllers/CompetitionTypeController.php index 430f7b5..a29d5db 100644 --- a/src/controllers/CompetitionTypeController.php +++ b/src/controllers/CompetitionTypeController.php @@ -29,7 +29,7 @@ class CompetitionTypeController extends BaseController { if ($this->competitionType->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/GameController.php b/src/controllers/GameController.php index 3ef9c37..15062c2 100644 --- a/src/controllers/GameController.php +++ b/src/controllers/GameController.php @@ -29,7 +29,7 @@ class GameController extends BaseController { if ($this->game->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/ParticipantController.php b/src/controllers/ParticipantController.php index 2ca28fb..a493146 100644 --- a/src/controllers/ParticipantController.php +++ b/src/controllers/ParticipantController.php @@ -29,7 +29,7 @@ class ParticipantController extends BaseController { if ($this->participant->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/UserController.php b/src/controllers/UserController.php index b5349d6..90e43ce 100644 --- a/src/controllers/UserController.php +++ b/src/controllers/UserController.php @@ -24,18 +24,6 @@ class UserController extends BaseController { return $this->user->findOrFail($id); } - public function login() { - Auth::basic(); - - if (!Auth::check()) { - throw new Exception\LoginException; - } elseif (!empty(Input::get('redirect'))) { - throw new Exception\RedirectException(Input::get('redirect')); - } - - return Auth::user(); - } - public function update($id) { $s = $this->user->find($id); @@ -45,7 +33,7 @@ class UserController extends BaseController { if ($s->save()) { return $this->show($id); } else { - throw new Dingo\Api\Exception\UpdateResourceFailedException; + throw new \Dingo\Api\Exception\UpdateResourceFailedException; } } @@ -66,7 +54,7 @@ class UserController extends BaseController { if ($this->user->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/UserTokenController.php b/src/controllers/UserTokenController.php index 2c2fe1e..99272ec 100644 --- a/src/controllers/UserTokenController.php +++ b/src/controllers/UserTokenController.php @@ -43,7 +43,7 @@ class UserTokenController extends BaseController { return $this->userToken; } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/routes.php b/src/routes.php index d44ac20..13b73da 100644 --- a/src/routes.php +++ b/src/routes.php @@ -2,8 +2,7 @@ Route::group(array('https'), function() { Route::api(['version' => 'v1', 'protected' => false], function () { - - Route::get('user/login', 'CamilStaps\BotleaguesApi\UserController@login'); + Route::resource('bot', 'CamilStaps\BotleaguesApi\BotController', ['only' => ['index','show']]); |