-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Password Field, drop multiple support in Email Field #924
Conversation
4d15359
to
539e632
Compare
e309fac
to
2996706
Compare
2996706
to
843ae16
Compare
/** | ||
* @var bool Permit entry of multiple email addresses, separated with comma (and extra spaces) | ||
*/ | ||
public $allow_multiple = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiple should be modelled by standard DB relation or using ContainsMany
Can you keep allow_multiple in please? Even though databases should store them in 1:n child tables (agree), a list of email recipients stored in a single text field is a use case that is valid and existing. |
that is what |
Cool. Every day something new to learn ;-) |
But will ContainsMany store them as comma separated list? I guess it will store them as PHP array or JSON instead. Meaning - ContainsMany solution will not be compatible with already existing DB field with comma separated values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Not sure if we should remove
allow_multiple
functionality ofEmail
field. It was handy and quite widely used. ContainsMany is not the same - it will encode array values or use json, but not plain CSV. Maybe we should introduce some kind of CSV field instead which will serialize array (values) as simple comma separated list? - I think
Password
field should use defaultset()
method instead ofsetPassword()
. And after model loading it should not show hash as value for security. In previousPassword
field implementation we stored hash value in separate fields property after model load and was able to use it for validating password, but it was never exposed to user. - Also think about this example:
$m = $user->load();
$m->set('p', $m->get('p')); // will hash password, your setPassword() method, so it get dirty
$m->save();
Theoretically if you get value and set it, then it shouldn't change and shouldn't become dirty. But if it hashes, then it'll change and save (overwrite old password).
So there are things i don't like about this.
Fully agree - the developer should have the option to still use comma-separated values. There definitely are valid use cases for that - not every field with multiple values justifies a 1:n table, or the need to render it in JSON |
Yeah. Imagine also list of phone numbers for person for example. Of course, in super normalized DB structure we should store them in separate table, but in reality 95% of time they will be stored as CSV in one field. So maybe we should have ContainsMany or something similar which serializes as simple CSV. Then we could use it + single Email field to get what we want - CSV list in one field in DB. |
tell me how :) values are newly normalized using stateless (non-entity-aware) the only option to prevent a rehash is to remember all newly seen passwords and store them globaly now, why you even think so? The Field class provides an interface to hash and verify the password hash which is stored in the underlaying type. Why should a non-hashed value be even stored somewhere? So maybe the field should be named
What? |
8d64dae
to
168e023
Compare
168e023
to
9f98e63
Compare
9ab78ab
to
e99efb1
Compare
f06b7f0
to
b1c6a32
Compare
48857c1
to
1839ad9
Compare
3753814
to
6fed773
Compare
No description provided.