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

Data Object with Activate and Deactivate password.

Go to End

3 Posts   756 Views


Community Member, 24 Posts

10 December 2013 at 6:44am

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!


Forum Moderator, 5523 Posts

11 December 2013 at 8:56pm

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.


Community Member, 24 Posts

12 December 2013 at 1:54pm

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

Thanks so much for your help!