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!
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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.
}
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!