예제 #1
0
 /**
  * Handle the command.
  *
  * @param StreamsHasInstalled $event
  */
 public function handle(StreamsHasInstalled $event)
 {
     $installers = $event->getInstallers();
     $installers->add(new Installer('Creating the admin user.', function () {
         $credentials = ['display_name' => 'Administrator', 'email' => env('ADMIN_EMAIL'), 'username' => env('ADMIN_USERNAME'), 'password' => env('ADMIN_PASSWORD')];
         if ($user = $this->users->findByUsername(env('ADMIN_USERNAME'))) {
             $user->email = env('ADMIN_EMAIL');
             $user->password = env('ADMIN_PASSWORD');
             $this->users->save($user);
         } else {
             $user = $this->users->create($credentials);
         }
         $this->activator->force($user);
     }));
 }
예제 #2
0
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @return bool
  */
 public function handle(UserRepositoryInterface $users)
 {
     $this->user->activated = true;
     $this->user->activation_code = null;
     $users->save($this->user);
     return true;
 }
 /**
  * Handle the form.
  *
  * @param PermissionFormBuilder   $builder
  * @param UserRepositoryInterface $users
  * @param Redirector              $redirect
  */
 public function handle(PermissionFormBuilder $builder, UserRepositoryInterface $users, Redirector $redirect)
 {
     /* @var UserInterface|EloquentModel $user */
     $user = $builder->getEntry();
     $users->save($user->setAttribute('permissions', array_filter(array_flatten($builder->getFormInput()))));
     $builder->setFormResponse($redirect->refresh());
 }
 /**
  * Handle the form.
  *
  * @param PermissionFormBuilder   $builder
  * @param UserRepositoryInterface $users
  * @param Redirector              $redirect
  */
 public function handle(PermissionFormBuilder $builder, UserRepositoryInterface $users, Redirector $redirect)
 {
     /* @var UserInterface $user */
     $user = $builder->getEntry();
     $users->save($user->setPermissions(array_keys(array_dot(array_map(function ($values) {
         return array_combine(array_values($values), array_pad([], count($values), true));
     }, array_filter($builder->getFormInput()))))));
     $builder->setFormResponse($redirect->refresh());
 }
 public function handle(UserRepositoryInterface $users, ActivationManager $activations)
 {
     $credentials = ['display_name' => 'Administrator', 'email' => env('ADMIN_EMAIL'), 'username' => env('ADMIN_USERNAME'), 'password' => env('ADMIN_PASSWORD')];
     if ($user = $users->findByUsername(env('ADMIN_USERNAME'))) {
         $user->email = env('ADMIN_EMAIL');
         $user->password = env('ADMIN_PASSWORD');
         $users->save($user);
     } else {
         $user = $users->create($credentials, true);
     }
     $activations->force($user);
 }
예제 #6
0
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @return bool
  */
 public function handle(UserRepositoryInterface $users)
 {
     if (!($user = $users->findByActivationCode($this->code))) {
         return false;
     }
     if ($this->user->getId() !== $user->getId()) {
         return false;
     }
     $this->user->activated = true;
     $this->user->activation_code = null;
     $users->save($this->user);
     return true;
 }
예제 #7
0
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @return bool
  */
 public function handle(UserRepositoryInterface $users)
 {
     $user = $users->findByResetCode($this->code);
     if (!$user) {
         return false;
     }
     if ($user->getId() !== $this->user->getId()) {
         return false;
     }
     $this->user->setAttribute('reset_code', null);
     $this->user->setAttribute('password', $this->password);
     $users->save($this->user);
     return true;
 }
예제 #8
0
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @return bool
  */
 public function handle(UserRepositoryInterface $users)
 {
     $users->save($this->user->setActivationCode(str_random(40)));
     return true;
 }
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @return bool
  */
 public function handle(UserRepositoryInterface $users)
 {
     $users->save($this->user->setAttribute('activation_code', str_random(40)));
     return true;
 }
 /**
  * If nothing is posted then
  * the user gets no permissions.
  *
  * @param UserRepositoryInterface $users
  */
 public function onPost(UserRepositoryInterface $users)
 {
     if (!$this->hasPostData() && ($entry = $this->getEntry())) {
         $users->save($entry->setAttribute('permissions', []));
     }
 }
예제 #11
0
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @return bool
  */
 public function handle(UserRepositoryInterface $users)
 {
     return $users->save($this->user->setAttribute('reset_code', str_random(40)));
 }