Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Data Object with Activate and Deactivate password.

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: 321 Views
  • BigD1214
    Avatar
    Community Member
    15 Posts

    Data Object with Activate and Deactivate password. Link to this post

    Hey guys!, So i have data objects that currently have a "active" attribute that needs a password in order to set the value to true. I am checking the password in the onbeforewrite function. I am needing to add a feature that is going to also use a password to deactivate it. The password to deactivate need to be different then activate password. Im running into all sorts of bugs with this. Anyone have and Ideas on how i can accomplish this? I think im am having a brain jam and need an idea to get me out of it. thanks!

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Data Object with Activate and Deactivate password. Link to this post

    How do you store the password to deactivate it? Is this password the user login password? To check whether a given string matches the users login password, you can do something like the following which takes a string and checks that this is the users password

    $password = "Foo";
    $member = Member::currentUser();

    $result = $member->checkPassword($password);
    if($result && $result->valid()) {
    return true; // the given string matches the user password.
    }

  • BigD1214
    Avatar
    Community Member
    15 Posts

    Re: Data Object with Activate and Deactivate password. Link to this post

    Thanks so much Willr. Very useful information. Any ideas on this subject?

    http://www.silverstripe.org/dataobjectmanager-module-forum/show/28974#post327198

    Thanks so much for your help!

    321 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.