FUSE update() doesn't work with R::graph

34 views
Skip to first unread message

Rikki

unread,
Mar 29, 2012, 5:32:23 AM3/29/12
to redbeanphp
Hi guys,

I'm trying to use the FUSE update function to alter a password field
from plain text to md5.

When I call the public function update() in the correct model, it
doesn't seem to fire...

dispense, delete, open etc all work. update and after_update don't...

Any ideas?

I'm using the $_POST to R::graph to successfully store my beans, but
am now stumped!

Cheers for any help you may have.

Rikki

Rikki

unread,
Apr 18, 2012, 4:38:23 AM4/18/12
to redbeanphp
I didn't realise this got set to published... Has anyone encountered
this issue?

Rikki

Rikki

unread,
Apr 19, 2012, 6:49:13 AM4/19/12
to redbeanphp
Got it working. My class that was doing my update hadn't referred to
my model file.

The following function might help others... It's preg_matches sha1
passwords and only updates the password field if the password isn't a
sha1 encrypted string.

function after_update() {
$sha1 = (bool) preg_match('/^[0-9a-f]{40}$/i', $this->password);
if (!$sha1) {
$user = R::load('users', $this->id);
$user->password = sha1($this->password);
R::store($user);
Reply all
Reply to author
Forward
0 new messages