sittercity / sprig

Object modeling system for Kohana, inspired by Django
MIT License
130 stars 29 forks source link

Automatic password hashing should be optional. #68

Open justinhernandez opened 14 years ago

justinhernandez commented 14 years ago

sprig.php line 470

if (isset($field->hash_with) AND $changed) { $changed = call_user_func($field->hash_with, $changed); }

should be changed to this

if (isset($field->hash_with) AND $changed) { if ($field->hash_with !== FALSE) $changed = call_user_func($field->hash_with, $changed); }

banks commented 14 years ago

Why?

If you don't want it, set it to NULL. A NULL value by definition fails isset().

justinhernandez commented 14 years ago

Yeah NULL will work. Just thought FALSE would be more in line with the rest of the options. I don't think auto hashing should be set by default. It's a good option to have but it can be confusing when approaching sprig for the first time.

HNygard commented 14 years ago

What if you just don't define hash_with? This will make the isset() fail and accordingly not hash the field.