Password Validation - Prototype issues?

advanced-prototyping

#1

Hey there,

I’m having a few issues in regards to dynamic password validation on typing. I’ve managed to get 5/6 of the interaction UI to respond on typing, but one of them (number) seems to be contradicted by the ‘lowercase letter’ validation! So far, I have as follows:

  • 10 or more characters (OnTextChange: IF length of this value is greater than 9) :white_check_mark:
  • 1 Uppercase character (OnTextChange: [[LVAR1.toLowercase()]] :white_check_mark:
  • 1 Lowercase character (OnTextChange: [[LVAR1.toUppercase()]] :white_check_mark:
    - 1 Number (OnkeyUp: IF text on this is numeric)
  • 1 Symbol (OnKeyUp: IF text on this is not alphanumeric) :white_check_mark:

It seems that the check for Number works until a user types alpha (non-numeric) character, which is to check if the text is not abc then reverts it back to an ‘unmatched’ state! Any advice or help would be greatly apprenticed.

cheers,
Sean


#2

Hi!

Well, this expression is a little absurd but it works. It checks if the string contains “0” or “1” or “2” or…

It does it in a single IF statement, so it’s not so bad. You test to see if the following expression is equal to true, where LVAR_txt is a local variable referring to the text of the field. The double-pipe means OR, and the indexOf() function returns 0 or greater if it finds the value.

[[ LVAR_txt.indexOf("0") >= 0 || LVAR_txt.indexOf("1") >= 0 || LVAR_txt.indexOf("2") >= 0 || LVAR_txt.indexOf("3") >= 0 || LVAR_txt.indexOf("4") >= 0 || LVAR_txt.indexOf("5") >= 0 || LVAR_txt.indexOf("6") >= 0 || LVAR_txt.indexOf("7") >= 0 || LVAR_txt.indexOf("8") >= 0 || LVAR_txt.indexOf("9") >= 0 ]]

test for at least one number.rp (46.6 KB)


#3

…and then it occurred to me that you can test the whole thing in a single IF statement if you are willing to specify which special characters are allowed…

[[ (LVAR_txt.length > 9 && LVAR_txt.toLowerCase() != LVAR_txt && LVAR_txt.toUpperCase() != LVAR_txt) && (LVAR_txt.indexOf("0") >= 0 || LVAR_txt.indexOf("1") >= 0 || LVAR_txt.indexOf("2") >= 0 || LVAR_txt.indexOf("3") >= 0 || LVAR_txt.indexOf("4") >= 0 || LVAR_txt.indexOf("5") >= 0 || LVAR_txt.indexOf("6") >= 0 || LVAR_txt.indexOf("7") >= 0 || LVAR_txt.indexOf("8") >= 0 || LVAR_txt.indexOf("9") >= 0) && (LVAR_txt.indexOf("!") >= 0 || LVAR_txt.indexOf("@") >= 0 || LVAR_txt.indexOf("#") >= 0 || LVAR_txt.indexOf("$") >= 0 || LVAR_txt.indexOf("%") >= 0 || LVAR_txt.indexOf("^") >= 0 || LVAR_txt.indexOf("&") >= 0 || LVAR_txt.indexOf("*") >= 0) ]]

One day Axure may add a function that applies a regex expression…


#4

Thanks so much for getting back to me - this looks amazing!

One quick, ‘newbie’ question, I’m assuming this interaction is On keyUp or TextChange right? I’d have to configure the panel action as a result of the validation to a green/matched state, as below:

LVAR_Axure%20PW

i’m not too sure where I’ve gone wrong? again, I’m used to sketch so axure is quite new! esp the level of prototyping.


#5

Maybe shorter to just chain together a bunch of .replace("0","") for each numeral then see if it’s the same as the original?