Jump to:

1036 Posts in 810 Topics by 315 members

Forum Module

SilverStripe Forums » Forum Module » ConfirmedPasswordField sets password to empty

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 975 Views
  • micschk
    Community Member
    19 Posts

    ConfirmedPasswordField sets password to empty Link to this post

    I am using the forum module on 3.0.3, and am customizing the memberprofile form. What I want is for a user's password to be unchanged if the password field is left empty. (In the default form, you have to fill out your password twice every time you want to update something in your profile.)

    So, I'm using the following code:

    public function updateForumFields(FieldList $fieldset) {

       $member = Member::currentUser();
          // Make filling out password optional for existing members (
          $fieldset->push( $pw = new ConfirmedPasswordField("Password", "Wachtwoord", null, null, $showOnClick = true, "Bevestig wachtwoord") );
       return $fieldset;


    This is producing a collapsible ConfirmedPasswordField ('Click link to change password'). But, the password still gets updated (to an empty string) even when a user hasn't edited/updated the password fields.

    Should I be checking for an empty password by hand somewhere in doSave()? Right now, the updating routine just consists of:


  • JonoM
    Community Member
    103 Posts

    Re: ConfirmedPasswordField sets password to empty Link to this post

    For anybody else with this problem - you can use setCanBeEmpty() on a ConfirmedPasswordField to allow this field to be empty. With this set if it's empty the field will be ignored when using saveInto() and it won't trigger a validation error.


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.