PAPasscode icon indicating copy to clipboard operation
PAPasscode copied to clipboard

Added custom validity checking delegate method to PAPasscode

Open JThramer opened this issue 12 years ago • 3 comments

So the general idea behind PAPasscodeViewController:checkPasscodeValidityWithEntry: is to enable the developer to implement a custom validity test for the entered passcode using whatever arbitrary means they see fit.

The reason why we implemented this delegate method is because for our solution, we store the passcode as a one-way hash that we obviously cannot unhash. Using this delegate method, we can hash the candidate entry and see if the hashes match.

Hope this helps!

(this is attempt #2, where the first attempt was closed by me because it was half-baked )

JThramer avatar Feb 27 '13 22:02 JThramer

Sorry, I can't accept the pull request in its current form. The feature idea is a good one, but I have a few issues with the pull request:

  1. Code unrelated to the feature shouldn't be included (like changing the navigation bar color)
  2. There are some other code formatting changes (moving braces to a new line) - it's better to remain consistent with the existing code.
  3. The use of the ternary operator in your new code makes it hard to read. A better approach would be to create a new local method to validate the passcode, which then uses the delegate or does a local comparision.

As I said, the idea is a good one so I'll give to thought to adding it. I'm also happy to consider another pull request.

Thanks, Denis

dhennessy avatar Mar 13 '13 19:03 dhennessy

I'll try cleaning it up some and removing our implementation-specific stuff (such as our black navbar) when i have a minute. Thanks for the reply.

JThramer avatar Mar 13 '13 20:03 JThramer

I was going to do a pull request for exactly the same reason. This is a great feature.

Nr9 avatar Mar 21 '13 16:03 Nr9

Closing as (extremely) stale.

JThramer avatar Mar 02 '23 18:03 JThramer