Execute the job.

@param UserRepository $users
@param PasswordResetRepository $resets
@param Repository $config
@param Mailer $mail
@param Dispatcher $event
@return void
515582
public function handle(UserRepository $users, PasswordResetRepository $resets, Repository $config, Mailer $mail, Dispatcher $event)
    {
        $resets->cleanUp($this->email);

        $user = $users->findByEmailAddress($this->email);

        $passwordReset = PasswordReset::generate($user);

        $resets->save($passwordReset);

        $mail->send(
            $config->get('authentication.passwordReset.email'),
            compact('user', 'passwordReset'),
            function (Message $message) use ($user, $config) {
                $message
                    ->from($config->get('authentication.passwordReset.from.email'), $config->get('authentication.passwordReset.from.name'))
                    ->to($user->email, $user->name)
                    ->subject(trans('authentication::password-reset.subject'));
            }
        );

        $event->fire(new PasswordResetLinkWasSent($passwordReset));
    }
1546
public function createWithUsers(array $data, $users)
    {
        $role = $this->create((array) $data);

        if (! empty($users)) {
            $role->users()->attach($users);
        }
    }
278128
public function resetUserConfig(UsersListener $listener, User $user)
    {
        try {
            $this->userConfigRepository->deleteByUserId($user->id);
            return $listener->resetSuccess();
        } catch (Exception $e) {
            Log::emergency($e->getMessage());
            return $listener->resetFailed();
        }
    }
117168
public function thereAreNoUsersWithTheEmail($email)
    {
        $users = $this->getRepository()->getUserService()->loadUsersByEmail($email);
        Assertion::assertEquals(0, count($users), "Users with the email '$email' exist");
    }
1359856
public function fill(UserInterface $user, array $credentials)
    {
        $this->fireEvent('sentinel.user.filling', compact('user', 'credentials'));

        $loginNames = $user->getLoginNames();

        list($logins, $password, $attributes) = $this->parseCredentials($credentials, $loginNames);

        if (is_array($logins)) {
            $user->fill($logins);
        } else {
            $loginName = reset($loginNames);

            $user->fill([
                $loginName => $logins,
            ]);
        }

        $user->fill($attributes);

        if (isset($password)) {
            $password = $this->hasher->hash($password);

            $user->fill(compact('password'));
        }

        $this->fireEvent('sentinel.user.filled', compact('user', 'credentials'));
    }
613705
protected function sendPasswordResetEmail(User $user)
    {
        $email = $user->email;

        /** @var \DreamFactory\Core\User\Services\User $parent */
        $parent = $this->getService();

        if (!empty($parent->passwordEmailServiceId)) {
            try {
                /** @var EmailServiceInterface $emailService */
                $emailService = ServiceManager::getServiceById($parent->passwordEmailServiceId);

                if (empty($emailService)) {
                    throw new ServiceUnavailableException("Bad email service identifier.");
                }

                $data = [];
                if (!empty($parent->passwordEmailTemplateId)) {
                    // find template in system db
                    $template = EmailTemplate::whereId($parent->passwordEmailTemplateId)->first();
                    if (empty($template)) {
                        throw new NotFoundException("Email Template id '{$parent->passwordEmailTemplateId}' not found");
                    }

                    $data = $template->toArray();
                }

                if (empty($data) || !is_array($data)) {
                    throw new ServiceUnavailableException("No data found in default email template for password reset.");
                }

                $data['to'] = $email;
                $data['content_header'] = 'Password Reset';
                $data['first_name'] = $user->first_name;
                $data['last_name'] = $user->last_name;
                $data['name'] = $user->name;
                $data['phone'] = $user->phone;
                $data['email'] = $user->email;
                $data['link'] = url(\Config::get('df.confirm_reset_url')) .
                    '?code=' . $user->confirm_code .
                    '&email=' . $email .
                    '&username=' . $user->username .
                    '&admin=' . $user->is_sys_admin;
                $data['confirm_code'] = $user->confirm_code;

                $bodyHtml = array_get($data, 'body_html');
                $bodyText = array_get($data, 'body_text');

                if (empty($bodyText) && !empty($bodyHtml)) {
                    $bodyText = strip_tags($bodyHtml);
                    $bodyText = preg_replace('/ +/', ' ', $bodyText);
                }

                $emailService->sendEmail($data, $bodyText, $bodyHtml);

                return true;
            } catch (\Exception $ex) {
                throw new InternalServerErrorException("Error processing password reset.\n{$ex->getMessage()}");
            }
        }

        return false;
    }
429342
public function beforeSave(Event $event, User $user)
    {
        if (!$user->isNew() && $user->has('password') && empty($user->password)) {
            $user->unsetProperty('password');
            $user->dirty('password', false);
        }
    }
901811
public function execute() {
        global $DB;
        if (is_enabled_auth('ldap')) {
            $auth = get_auth_plugin('ldap');
            $users = $DB->get_records('user', array('auth' => 'ldap'));
            foreach ($users as $user) {
                $auth->sync_roles($user);
            }
        }
    }
700555
public function preUpdate(User $user, PreUpdateEventArgs $event)
    {
        if ($event->hasChangedField('password')) {
            $event->setNewValue('password', $this->encodePassword($user));
        }
    }
1124164
public function execute() {
        global $DB, $CFG;

        // Cleanup user password reset records.
        // Delete any reset request records which are expired by more than a day.
        // (We keep recently expired requests around so we can give a different error msg to users who
        // are trying to user a recently expired reset attempt).
        $pwresettime = isset($CFG->pwresettime) ? $CFG->pwresettime : 1800;
        $earliestvalid = time() - $pwresettime - DAYSECS;
        $DB->delete_records_select('user_password_resets', "timerequested < ?", array($earliestvalid));
        mtrace(' Cleaned up old password reset records');

    }
801856
public function handle(UserRepository $users, Dispatcher $event)
    {
        $user = $users->find($this->id);

        $user->unban();

        $users->save($user);

        $event->fire(new UserWasUnbanned($user));
    }
676416
public function handle(PasswordResetRepository $resets, Hasher $hash, UserRepository $users, Dispatcher $event)
    {
        $reset = $resets->findByEmailAndToken($this->email, $this->token);

        if ($reset->isExpired()) {
            throw new TokenIsExpired();
        }

        $user = $users->findByEmailAddress($this->email);
        $user->password = $hash->make($this->password);
        $users->save($user);

        $event->fire(new PasswordWasReset($user));
    }
486187
protected function fireAuthenticatedEvent(User $user, $model = null)
    {
        Event::dispatch(new AuthenticatedWithWindows($user, $model));
    }
287243
public function sendNewUser(string $email, string $username, string $password): void
	{
		$mail = $this->createMail('newUser');

		$mail->link = $this->link('Cms:Sign:in');
		$mail->username = $username;
		$mail->password = $password;

		$mail->setSubject('cms.mailing.newUser.subject')
			->addTo($email);

		$mail->send();
	}
119535
public function activate($username)
    {
        $user = $this->findUserByUsernameOrThrowException($username);
        $user->setEnabled(true);
        $this->userManager->updateUser($user);

        $event = new UserEvent($user, $this->getRequest());
        $this->dispatcher->dispatch(Events::USER_ACTIVATED, $event);
    }
261752
public function PasswordReset($UserID = '', $PasswordResetKey = '') {
      if (!is_numeric($UserID)
          || $PasswordResetKey == ''
          || $this->UserModel->GetAttribute($UserID, 'PasswordResetKey', '') != $PasswordResetKey
         ) $this->Form->AddError('Failed to authenticate your password reset request. Try using the reset request form again.');

      if ($this->Form->ErrorCount() == 0) {
         $User = $this->UserModel->GetID($UserID, DATASET_TYPE_ARRAY);
         if ($User) {
            $User = ArrayTranslate($User, array('UserID', 'Name', 'Email'));
            $this->SetData('User', $User);
         }
      }
      
      if ($this->Form->ErrorCount() == 0
         && $this->Form->IsPostBack() === TRUE
      ) {
         $Password = $this->Form->GetFormValue('Password', '');
         $Confirm = $this->Form->GetFormValue('Confirm', '');
         if ($Password == '')
            $this->Form->AddError('Your new password is invalid');
         else if ($Password != $Confirm)
            $this->Form->AddError('Your passwords did not match.');

         if ($this->Form->ErrorCount() == 0) {
            $User = $this->UserModel->PasswordReset($UserID, $Password);
            Gdn::Session()->Start($User->UserID, TRUE);
//            $Authenticator = Gdn::Authenticator()->AuthenticateWith('password');
//            $Authenticator->FetchData($Authenticator, array('Email' => $User->Email, 'Password' => $Password, 'RememberMe' => FALSE));
//            $AuthUserID = $Authenticator->Authenticate();
				Redirect('/');
         }
      }
      $this->Render();
   }
56986
public function handle(Mailer $mailer)
    {
        $mailer->send(
            'gzero-core::emails.auth.welcome',
            ['user' => $this->user],
            function ($m) {
                $m->to($this->user->email, $this->user->getPresenter()->displayName())
                    ->subject(trans('emails.welcome.subject', ['siteName' => config('app.name')]));
            }
        );
    }