Re: Tip request: How to avoid coercing twice in NSValidation
Re: Tip request: How to avoid coercing twice in NSValidation
- Subject: Re: Tip request: How to avoid coercing twice in NSValidation
- From: Paul Hoadley <email@hidden>
- Date: Wed, 24 May 2017 09:28:47 +0930
Hi Riccardo,On 23 May 2017, at 19:03, Riccardo De Menna < email@hidden> wrote:
What should I do to avoid this?
I don’t think I’d do it at all. This sounds like a bogus use of NSValidation, for at least the reason you’ve already detailed: it’s not idempotent. Surely if a call to validateValueForKey() returns a value that’s declared valid for the property, then a further call should just return that valid value unchanged. Obviously that’s what you’re trying to simulate, but even if you can detect a value that’s been hashed already, why wouldn’t _that hash_ be a valid plaintext password itself?
One idea would be to intercept component validation on validateTakeValueForKeyPath and skip coercion there. Or skip it later on the validateForSave.
What would be the right way? Also… is it somehow guaranteed that validation happens twice? Could it happen three times? More? If so, my idea would not work.
I imagine it could happen an arbitrary number of times if validation repeatedly fails for some unrelated reason and you allow the user to re-submit the form.
Do it some other way.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden