aboutsummaryrefslogtreecommitdiff
path: root/src/controllers/UserController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers/UserController.php')
-rw-r--r--src/controllers/UserController.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/controllers/UserController.php b/src/controllers/UserController.php
index 02400e9..03bebbc 100644
--- a/src/controllers/UserController.php
+++ b/src/controllers/UserController.php
@@ -4,7 +4,6 @@ namespace CamilStaps\BotleaguesApi;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Input;
-use Illuminate\Support\Facades\Redirect;
class UserController extends BaseController {
@@ -12,6 +11,8 @@ class UserController extends BaseController {
public function __construct(User $user) {
$this->user = $user;
+
+ $this->beforeFilter('current_user', array('only' => ['update', 'destroy']));
}
public function index() {
@@ -23,10 +24,6 @@ class UserController extends BaseController {
}
public function update($id) {
- if ($id != Auth::user()->id) {
- throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException();
- }
-
$s = $this->user->find($id);
if (!empty(Input::get('password')))
@@ -41,7 +38,7 @@ class UserController extends BaseController {
public function store() {
$this->user->email = Input::get('email');
- $this->user->password = Hash::make(Input::get('password'));
+ $this->user->password = empty(Input::get('password')) ? null : Hash::make(Input::get('password'));
if ($this->user->save()) {
return $this->response->created();