Jump to:

23479 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Add a no disclosure charter

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

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

Page: 1
Go to End
Author Topic: 372 Views
  • plop
    Avatar
    Community Member
    2 Posts

    Add a no disclosure charter Link to this post

    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,

    Rom

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

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Add a no disclosure charter Link to this post

    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');
    $validateMember->save();
    http://api.silverstripe.org/2.4/sapphire/security/Member.html#methodchangePassword

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

  • plop
    Avatar
    Community Member
    2 Posts

    Re: Add a no disclosure charter Link to this post

    Hi Bambii7,

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

    here is my custom MemberLoginForm ==> http://pastebin.com/embed_js.php?i=FSFc7D5v
    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

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

    See you,

    Rom

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Add a no disclosure charter Link to this post

    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 http://www.ssbits.com/snippets/2010/customize-the-redirect-after-a-successful-member-login/

    Sorry I can't be of more help.

    372 Views
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.