Esempio n. 1
0
 /**
  * Register a new user via the RegisterUserCommand, and manage any errors that may occur.
  *
  * @param array $input
  * @param RegistrationListenerInterface $registrationListener
  */
 public function registerUser(array $input = [], RegistrationObserverInterface $registrationListener)
 {
     try {
         $command = new RegisterUserCommand($input['firstName'], $input['lastName'], $input['email'], $input['password'], $input['password_confirmation'], $input['g-recaptcha-response']);
         $user = $this->commandBus->execute($command);
         return $registrationListener->onSuccess($user);
     } catch (ValidationException $e) {
         return $registrationListener->onValidationError($e);
     }
 }
Esempio n. 2
0
 /**
  * Update user profile information
  *
  * @param array                                                                         $input
  * @param \Tectonic\Shift\Modules\Identity\Users\Contracts\UserProfileObserverInterface $responder
  *
  * @return mixed
  */
 public function updateProfile($input, UserProfileObserverInterface $responder)
 {
     try {
         $command = new UpdateUserProfileCommand(Auth::user(), $input['firstName'], $input['lastName'], $input['email'], $input['password'], $input['passwordConfirmation']);
         $updatedUserProfile = $this->commandBus->execute($command);
         return $responder->onSuccess($updatedUserProfile);
     } catch (ValidationException $e) {
         return $responder->onValidationFailure($e);
     }
 }
Esempio n. 3
0
 /**
  * Called on a new installation of Shift. Validates the input provided
  *
  * @param array $input
  * @param InstallationResponderInterface $responder
  * @return mixed
  */
 public function freshInstall(array $input = [], InstallationResponderInterface $responder)
 {
     $command = new InstallShiftCommand($input['name'], $input['host'], $input['language'], $input['email'], $input['password']);
     try {
         $this->commandBus->execute($command);
     } catch (ValidationException $exception) {
         return $responder->onValidationFailure($exception);
     } catch (Exception $exception) {
         return $responder->onFailure($exception);
     }
     return $responder->onSuccess();
 }
Esempio n. 4
0
 /**
  * Manage the updating of a specific role, based on the slug provided.
  *
  * @Put("roles/{slug}", middleware={"shift.account", "shift.auth"}, as="roles.update")
  *
  * @param string $slug
  * @return mixed
  */
 public function putUpdate($slug)
 {
     $input = Input::get();
     $input['slug'] = $slug;
     $command = UpdateRoleCommand::withInput($input);
     $this->commandBus->execute($command);
     return Redirect::route('roles.index');
 }
Esempio n. 5
0
 /**
  * Update a specific user record based on the.
  *
  * @Put("users", middleware={"shift.account", "shift.auth"}, as="users.update")
  *
  * @param string $slug
  * @return mixed
  */
 public function putUpdate($slug)
 {
     $input = Input::get();
     $input['slug'] = $slug;
     $command = UpdateUserCommand::fromInput($input);
     $this->commandBus->execute($command);
     return Redirect::route('users.index');
 }
Esempio n. 6
0
 /**
  * Create a new account based on the input provided.
  *
  * @Post("accounts", middleware={"shift.account", "shift.auth"}, as="accounts.create")
  *
  * @return mixed
  */
 public function postStore()
 {
     $command = CreateAccountCommand::fromInput(Input::get());
     $this->commandBus->execute($command);
     return Redirect::route('accounts.index');
 }
Esempio n. 7
0
 /**
  * Attempt logout for current user.
  *
  * @param \Illuminate\Auth\UserInterface                                            $user
  * @param \Tectonic\Shift\Modules\Authentication\Contracts\LogoutResponderInterface $responder
  *
  * @return mixed
  */
 public function logout(UserInterface $user, LogoutResponderInterface $responder)
 {
     $command = new LogoutUserCommand($user);
     $this->commandBus->execute($command);
     return $responder->onSuccess($user);
 }