jelly-auth icon indicating copy to clipboard operation
jelly-auth copied to clipboard

Update Auth_Jelly::_get_object() to use "unique_key"

Open aron opened this issue 14 years ago • 2 comments

This would allow you to login using any parameter supported by the unique key method. For example an email address. The ORM Auth module currently supports this.

Update line 264 in classes/auth/jelly.php to use Jelly_Builder::load() which uses the :unique_key parameter internally.

// From
$current = Jelly::select('user')->where('user', '=', $user)->limit(1)->execute();

// To
$current = Jelly::select('user')->load($user);

Cheers,

Aron

aron avatar Jul 15 '10 15:07 aron

Hi Aron,

There was a bug in Jelly that prevented me to use this. Can you confirm if this is fixed on the latest commit?

Thanks.

raeldc avatar Jul 15 '10 15:07 raeldc

Hey,

The bug only affects Jelly_Builder::load() when no $key is passed in, it returns an unloaded model. Even so perhaps a better way to write this would be;

$current = Jelly::select('user')->where(':unique_key', '=', $user)->limit(1)->execute();

Then you don't get an empty model if the $user parameter is falsy.

Cheers,

Aron

aron avatar Jul 15 '10 16:07 aron