• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tip request: How to avoid coercing twice in NSValidation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

What do you think?

Do it some other way.


-- 
Paul Hoadley
http://logicsquad.net/
https://www.linkedin.com/company/logic-squad/



 _______________________________________________
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

References: 
 >Tip request: How to avoid coercing twice in NSValidation (From: Riccardo De Menna <email@hidden>)

  • Prev by Date: Re: Tip request: How to avoid coercing twice in NSValidation
  • Next by Date: Re: Tip request: How to avoid coercing twice in NSValidation
  • Previous by thread: Re: Tip request: How to avoid coercing twice in NSValidation
  • Next by thread: Save order of EO objects to support database foreign key constraints.
  • Index(es):
    • Date
    • Thread