/**
  * Update user permissions
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param  int $userId
  * @return Response
  */
 public function update($userId)
 {
     try {
         $permissions = Input::get('permissions', array());
         $this->users->updatePermissions($userId, $permissions);
         return Redirect::route('admin.users.index')->with('success', Lang::get('admin::users.permissions_update_success'));
     } catch (UserNotFoundException $e) {
         return Redirect::route('admin.users.permissions')->with('error', $e->getMessage());
     }
 }
 /**
  * Update the throttle status for a given user
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param $id
  * @param $action
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function putStatus($id, $action)
 {
     try {
         $this->users->updateThrottleStatus($id, $action);
         return Redirect::route('admin.users.index')->with('success', Lang::get('admin::throttle.success', array('action' => $action)));
     } catch (UserNotFoundException $e) {
         return Redirect::route('admin.users.index')->with('error', $e->getMessage());
     } catch (\BadMethodCallException $e) {
         return Redirect::route('admin.users.index')->with('error', "This method is not suported [{$action}]");
     }
 }
 /**
  * Reset a given user password
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param array $creds
  *
  * @return bool
  */
 public function reset(array $creds)
 {
     try {
         if ($this->validator->with($creds)->passes()) {
             $this->users->resetPassword($creds['code'], $creds['password']);
             return true;
         }
     } catch (UserNotFoundException $e) {
         $this->validator->add('UserNotFoundException', $e->getMessage());
     }
     return false;
 }
 /**
  * Activate a user
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function putActivate($id)
 {
     try {
         if ($this->users->activate($id)) {
             // User activation passed
             return Redirect::route('admin.users.index')->with('success', Lang::get('admin::users.activation_success'));
         } else {
             // User activation failed
             return Redirect::route('admin.users.index')->with('error', Lang::get('admin::users.activation_fail'));
         }
     } catch (UserNotFoundException $e) {
         return Redirect::route('admin.users.index')->with('error', $e->getMessage());
     }
 }
Example #5
0
 /**
  * Validate and log in a user
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param array $credentials
  * @param bool  $remember
  *
  * @return bool
  */
 public function login(array $credentials, $remember)
 {
     try {
         $this->users->authenticate($credentials, $remember);
         return true;
     } catch (LoginRequiredException $e) {
         $this->validator->add('LoginRequiredException', $e->getMessage());
     } catch (PasswordRequiredException $e) {
         $this->validator->add('PasswordRequiredException', $e->getMessage());
     } catch (WrongPasswordException $e) {
         $this->validator->add('WrongPasswordException', $e->getMessage());
     } catch (UserNotActivatedException $e) {
         $this->validator->add('UserNotActivatedException', $e->getMessage());
     } catch (UserNotFoundException $e) {
         $this->validator->add('UserNotFoundException', $e->getMessage());
     } catch (UserSuspendedException $e) {
         $this->validator->add('UserSuspendedException', $e->getMessage());
     } catch (UserBannedException $e) {
         $this->validator->add('UserBannedException', $e->getMessage());
     }
     return false;
 }
 /**
  * Logs out the current user
  *
  * @author ZZK
  * @link    http://verecom.com
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getLogout()
 {
     $this->users->logout();
     return Redirect::route('admin.login')->with('success', Lang::get('admin::users.logout'));
 }