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.

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.

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   847 Views

Avatar
BigD1214

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!

Avatar
Willr

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

Avatar
BigD1214

Community Member, 24 Posts

12 December 2013 at 1:54pm

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!