common/services/entities/UserService.php
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;
	}
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;
	}
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 ; }
The method generate a new secure password for the given password and unset the reset token. It also activate user.
@param User $user
@param ResetPasswordForm $resetForm
@param boolean $activate
@return User
The method generate a new secure password for the given password and unset the reset token . It also activate user .