Beispiel #1
0
 /**
  * Handle the validation.
  *
  * @param UserRepositoryInterface $users
  * @param                         $value
  * @return bool
  */
 public function handle(UserRepositoryInterface $users, $value)
 {
     if (!$users->findByEmail($value)) {
         return false;
     }
     return true;
 }
 /**
  * Handle the form.
  *
  * @param ForgotPasswordFormBuilder $builder
  * @param UserRepositoryInterface   $users
  * @param UserPassword              $password
  */
 public function handle(ForgotPasswordFormBuilder $builder, UserRepositoryInterface $users, UserPassword $password, Repository $config)
 {
     $user = $users->findByEmail($builder->getFormValue('email'));
     if ($path = $builder->getFormOption('reset_path')) {
         $config->set('anomaly.module.users::paths.reset', $path);
     }
     $password->forgot($user);
     $password->send($user, $builder->getFormOption('reset_redirect'));
 }
 /**
  * Handle the form.
  *
  * @param ForgotPasswordFormBuilder $builder
  * @param UserRepositoryInterface   $users
  * @param UserPassword              $password
  * @param MessageBag                $messages
  * @param Repository                $config
  */
 public function handle(ForgotPasswordFormBuilder $builder, UserRepositoryInterface $users, UserPassword $password, MessageBag $messages, Repository $config)
 {
     if ($builder->hasFormErrors()) {
         return;
     }
     $user = $users->findByEmail($builder->getFormValue('email'));
     if ($path = $builder->getFormOption('reset_path')) {
         $config->set('anomaly.module.users::paths.reset', $path);
     }
     $password->forgot($user);
     $password->send($user, $builder->getFormOption('reset_redirect'));
     $messages->success('anomaly.module.users::message.confirm_reset_password');
 }
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @param UserActivator           $activator
  * @param Encrypter               $encrypter
  * @param Request                 $request
  * @return bool
  */
 public function handle(UserRepositoryInterface $users, UserActivator $activator, Encrypter $encrypter, Request $request)
 {
     $code = $request->get('code');
     $email = $request->get('email');
     if (!$code || !$email) {
         return false;
     }
     $code = $encrypter->decrypt($code);
     $email = $encrypter->decrypt($email);
     if (!($user = $users->findByEmail($email))) {
         return false;
     }
     return $activator->activate($user, $code);
 }
Beispiel #5
0
 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @param Guard                   $auth
  * @return \Anomaly\UsersModule\User\Contract\UserInterface|\Illuminate\Contracts\Auth\Authenticatable|null
  */
 public function handle(UserRepositoryInterface $users, Guard $auth)
 {
     if (is_null($this->identifier)) {
         return $auth->user();
     }
     if (is_numeric($this->identifier)) {
         return $users->find($this->identifier);
     }
     if (filter_var($this->identifier, FILTER_VALIDATE_EMAIL)) {
         return $users->findByEmail($this->identifier);
     }
     if (!is_numeric($this->identifier)) {
         return $users->findByUsername($this->identifier);
     }
     return null;
 }
 /**
  * Handle the form.
  *
  * @param UserRepositoryInterface  $users
  * @param ResetPasswordFormBuilder $builder
  * @param MessageBag               $messages
  * @param UserPassword             $password
  */
 public function handle(UserRepositoryInterface $users, ResetPasswordFormBuilder $builder, MessageBag $messages, UserPassword $password)
 {
     $user = $users->findByEmail($builder->getEmail());
     /**
      * If we can't find the user by the email
      * provided then head back to the form.
      */
     if (!$user) {
         $messages->error(trans('anomaly.module.users::error.reset_password'));
         return;
     }
     /**
      * If we can't successfully reset the
      * provided user then back back to the form.
      */
     if (!$password->reset($user, $builder->getCode(), $builder->getFormValue('password'))) {
         $messages->error(trans('anomaly.module.users::error.reset_password'));
         return;
     }
     $messages->success(trans('anomaly.module.users::success.reset_password'));
 }