resetPassword

Sends mail if an user requested a new password.

@param \CakeAdmin\Model\Entity\Administrator $user User entity.
@return void
331329
public function resetPassword($user)
    {
        $from = Configure::read('CA.email.from');
        $fullBaseUrl = Setting::read('App.BaseUrl');

        $this->domain($fullBaseUrl);

        $this->viewVars([
            'user' => $user,
            'resetUrl' => $fullBaseUrl . '/admin/users/reset/' . $user['email'] . '/' . $user['request_key'],
            'baseUrl' => $fullBaseUrl,
            'loginUrl' => $fullBaseUrl . '/admin',
            'from' => reset($from),
        ]);

        $this->template('CakeAdmin.resetPassword', 'CakeAdmin.default');
        $this->emailFormat('both');
        $this->from($from);
        $this->to($user['email']);
        $this->subject(__d('CakeAdmin', 'Forgot Password'));
        $this->transport(Configure::read('CA.email.transport'));
    }
755693
public function sendPasswordResetToken(EntityInterface $user, $options = []) {
		$options = Hash::merge($this->_config['sendPasswordResetToken'], $options);
		$this->getMailer($this->getConfig('mailer'))
			->send('passwordResetToken', [$user, $options]);
	}
516917
public function update(User $administrator, Request $request)
    {
        $this->validate($request, [
            'firstname' => 'required',
            'lastname'  => 'required',
            'roles'     => 'required|array',
        ]);

        $this->updateEntry($administrator, $request->only([
            'firstname',
            'lastname',
            'cellphone',
            'telephone',
            'born_at'
        ]));

        $administrator->roles()->sync(input('roles'));

        return redirect_to_resource();
    }
436329
public function resetPassword()
    {
        $user = $this->_user;
        $user->setPassword($this->password);
        $user->removePasswordResetToken();
        Event::off(BaseActiveRecord::className(), BaseActiveRecord::EVENT_AFTER_UPDATE);

        return $user->save(false);
    }
717300
public function setUser(\Concrete\Core\Entity\User\User $user)
    {
        $this->author = $user;
        $this->save();
    }
207335
protected function deleteExisting(CanResetPassword $user)
    {
        return $this->getTable()
                    ->delete($this->table)
                    ->where('email = :email')
                    ->setParameter('email', $user->getEmailForPasswordReset())
                    ->execute();
    }
1146681
public function updateUnidentifiedKey($user)
    {
        $userClass = $this->getUserClass($user);
        if (isset($this->encryptedKeys[$userClass]) && isset($this->encryptedKeys[$userClass][""])) {
            $this->encryptedKeys[$userClass][$user->getId()] = $this->encryptedKeys[$userClass][""];
            unset($this->encryptedKeys[$userClass][""]);
        }
    }
1077062
public function grantTo($user): void
    {
        $userModel = config('auth.providers.users.model');

        if (is_int($user) && !$userModel::find($user)) {
            return;
        }

        $this->users()->attach($user);
    }
178142
public function set_user($user)
    {
        if (is_object($user)) {
            $this->user = $user;

            // overwrite config with user preferences
            $this->config->set_user_prefs((array)$this->user->get_prefs());
        }
    }
1369487
public function resetPassword( $user, $resetForm ) {

		$modelClass	= static::$modelClass;

		// Find existing user
		$userToUpdate = $modelClass::findById( $user->id );

		// Generate Password
		$userToUpdate->generatePassword( $resetForm->password );
		$userToUpdate->unsetResetToken();

		// User need admin approval
		if( Yii::$app->core->isUserApproval() ) {

			$userToUpdate->verify();
		}
		// Direct approval and activation
		else {

			$userToUpdate->status = User::STATUS_ACTIVE;
		}

		// Update User
		$userToUpdate->update();

		return $userToUpdate;
	}
984294
protected function setUserInfo($user, $password = null)
    {
        $this->userInfo = $user . ((null !== $password) ? (':' . $password) : '');
    }
680846
def send_password_reset_notice(user):
    
    if config_value('SEND_PASSWORD_RESET_NOTICE_EMAIL'):
        _security.send_mail(config_value('EMAIL_SUBJECT_PASSWORD_NOTICE'),
                            user.email, 'reset_notice', user=user)
1102644
public function resetPassword(UserEntity $user, $newPassword)
    {
        $hashedPassword = $this->hashPassword($newPassword);

        $user->setPassword($hashedPassword);

        return $this->userMapper->persist($user);
    }
106509
public function withUserInfo($user, $password = null)
    {
        $this->user = $user;
        $this->password = $password;

        return $this;
    }
579356
private function resetEmail(UserInterface $user)
    {
        $ttl = $this->container->getParameter('fos_user.resetting.token_ttl');
        if ($user->isPasswordRequestNonExpired($ttl)) {
            return self::RESET_EMAIL_ALREADY_SENT;
        }

        if (null === $user->getConfirmationToken()) {
            /**
             * @var $tokenGenerator \FOS\UserBundle\Util\TokenGeneratorInterface
             */
            $tokenGenerator = $this->container->get('fos_user.util.token_generator');
            $user->setConfirmationToken($tokenGenerator->generateToken());
        }

        $this->container->get('session')->set(
            static::SESSION_EMAIL,
            $this->getObfuscatedEmail($user)
        );
        $this->container->get('fos_user.mailer')->sendResettingEmailMessage($user);
        $user->setPasswordRequestedAt(new \DateTime());
        $this->container->get('fos_user.user_manager')->updateUser($user);

        return self::RESET_EMAIL_OK;
    }
838488
public function changeUserPassword($user, $password)
    {
        $params = [
            'name' => $user,
            'password' => $password,
        ];

        $body = $this->request(self::URI_AUTH_USER_CHANGE_PASSWORD, $params);

        return $body;
    }
747043
public function saveUserForResetPassword(BaseUser $user)
    {
        $user->setForgetPasswordToken(null)
            ->setForgetPasswordExpired(null);

        $this->saveUserWithPlainPassword($user);
    }