src/Forms/ConfirmedPasswordField.php
public function setRequireExistingPassword($show)
    {
        // Don't modify if already added / removed
        if ((bool)$show === $this->requireExistingPassword) {
            return $this;
        }
        $this->requireExistingPassword = $show;
        $name = $this->getName();
        $currentName = "{$name}[_CurrentPassword]";
        if ($show) {
            $confirmField = PasswordField::create($currentName, _t('SilverStripe\\Security\\Member.CURRENT_PASSWORD', 'Current Password'));
            $this->getChildren()->unshift($confirmField);
        } else {
            $this->getChildren()->removeByName($currentName, true);
        }
        return $this;
    }
public function setRequireExistingPassword($show)
    {
        // Don't modify if already added / removed
        if ((bool)$show === $this->requireExistingPassword) {
            return $this;
        }
        $this->requireExistingPassword = $show;
        $name = $this->getName();
        $currentName = "{$name}[_CurrentPassword]";
        if ($show) {
            $confirmField = PasswordField::create($currentName, _t('SilverStripe\\Security\\Member.CURRENT_PASSWORD', 'Current Password'));
            $this->getChildren()->unshift($confirmField);
        } else {
            $this->getChildren()->removeByName($currentName, true);
        }
        return $this;
    }
public function setRequireExistingPassword ( $ show ) { // Don't modify if already added / removed if ( ( bool ) $ show === $ this -> requireExistingPassword ) { return $ this ; } $ this -> requireExistingPassword = $ show ; $ name = $ this -> getName ( ) ; $ currentName = "{$name}[_CurrentPassword]" ; if ( $ show ) { $ confirmField = PasswordField :: create ( $ currentName , _t ( 'SilverStripe\\Security\\Member.CURRENT_PASSWORD' , 'Current Password' ) ) ; $ this -> getChildren ( ) -> unshift ( $ confirmField ) ; } else { $ this -> getChildren ( ) -> removeByName ( $ currentName , true ) ; } return $ this ; }
Set if the existing password should be required

@param bool $show Flag to show or hide this field
@return $this
Set if the existing password should be required