Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Add a no disclosure charter

Go to End

4 Posts   714 Views


Community Member, 2 Posts

14 June 2012 at 4:55am

Hi everyone,

I use SS for 3 month by now but I still have some misunderstanding, I was looking for a topic which is talking about my issue but I don't find anything so I create mine, it's the next :

To my work I have to add a no disclosure charter that my new users have to accept to can log in.

I have already create my own MemberLoginForm and add "elseif(Member::currentUser()->NumVisit <=1)" in the dologin function to catch all news members that wanna log in.

At this point I wanna those news members are redirected to my disclosure charter and have to accept it to log in ( this charter is shown only for the first log in ).

Some co workers said to me that I can use a session variable.

Like create my own : Session::set('acceptForm, true);
and after test it on my controller : if(Session::get('acceptForm') != true) Director::redirect('confirmation-page/')

I tried to do this but i don't really know how it's works.

Another issue : I wanna that my news users have to change their password when they log in for the first time.

the best scenario is the next :

- the user come to the login page
- fill out the form with his personnal informations
- He is redirected to my disclosure charter
- Read my charter and accept it
- Again redirection to /security/changepassword to choose a new password
- if all these steps are sucessful, he is correctly log in

That is,

I hope you will understand my problem and can help me :)

I thank in advance who will answer me.

best regards,


ps : I apologize for my bad english :p , isn't an excuse but i'm french ^^


Community Member, 254 Posts

14 June 2012 at 3:58pm

This is a difficult one to answer.
I would suggest extending the Member class and adding 'acceptedCharter' = "Boolean" rather than relying on the NumVisit
and on completion of the form switch this value to true. So when you are catching all new members you can check if this value is set.

To keep things simple you could have the new password form in with the accept charter form. Then in the form complete function add
$validateMember = $Member::crrentUser();
$validateMember->changePassword('users new password here');

Perhaps posting the code you have so far could help.
PS you're English is quite good :)


Community Member, 2 Posts

14 June 2012 at 8:16pm

Edited: 14/06/2012 8:23pm

Hi Bambii7,

First of all thx to have taking the time to answer me.

here is my custom MemberLoginForm ==>
I wanna add my charter form on line 150.
Concerning the change of the password, if I use the "$validateMember->changePassword('users new password here');"
It will call the security/changepassword page ? or I have to do by myself ? Cause I add some controls when a new password is required. I.e I use the password validator with some length, strength etc.

I guess the best way to do this is do add a redirection on the accept button of my charter form that do all work for me.

Another point, Can i create the form on the line 150 just like that or I have to add a new classe that extending the form class ?
I'm not sure what is the good way to do this :p

that is, if you have some others ideas i'm taking them :)

See you,



Community Member, 254 Posts

19 June 2012 at 5:41pm

I would extend the form class for your change password form (or any others), it will get messy if you make it on line 150.
You should be able to check length and strength of password before calling changePassword()

And here is some useful stuff on MemberLogin form if you have not found it yet

Sorry I can't be of more help.