Page 1 of 1

Password Check

Posted: Mon Apr 29, 2019 3:48 am
by Quinton B.
Good day, bellow is the code that I've used thus far to evaluate if the user has a password with special characters:

Code: Select all

put "`~!@#$%^&*()_-+=}{][|\<,>.?/" into tList175
         if any char of tList175 is not in the text of field "RegisterPassword" then
            answer "Please add a special character to your Password", "eg.`~!@#$%^&*()_-+=}{][|\<,>.?/"
            put false into tPassCheck -- This means the password does not contain special characters
         else
            put true into tPassCheck
However, I'm trying to rewrite it to tell me what character was found within the user's password to make it true and how many special characters are within the password. :

Code: Select all

on mouseUp
   put "`~!@#$%^&*()_-+=}{][|\<,>.?/" into tList175
   --if any char of tList175 is not in t1 then
   if field "HELLO" contains any char of tList175 then
      put it into t2
      answer t2
   else
      answer "NOPE"
   end if
end mouseUp
Is there a way to return the variable that turned an if statement into true or false?

Re: Password Check

Posted: Mon Apr 29, 2019 8:30 am
by FourthWorld
You could turn that into a function.

But more recent guidance on password strength in our post-rainbow-tables world is to favor length over complexity:

https://www.xkcd.com/936/

Not only more secure given modern tooling, but easier for developers to provide guidance for.

Re: Password Check

Posted: Mon Apr 29, 2019 3:17 pm
by SparkOut
Unless you happen to have "correct horse battery staple" as your password. I 'll bet there are (probably few, but greater than 1) people who have used that as their own.

But more seriously, @Quinton, have you actually had success in determining what you want with your code as written? The way you have it, "any" means "any ONE randomly chosen value from the pool" not "it doesn't matter which of the pool".
ie

Code: Select all

if field "HELLO" contains any char of tList175 then
will resolve any char of tList175 to a single random chae, let's say "+" and your conditional statement becomes

Code: Select all

if field "HELLO" contains "+" then
To test correctly you will need to compare the whole pool to see if the target field contains an instance.
There will be a use-case for regex here, I think.