Password Check

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Password Check

Post by Quinton B. » Mon Apr 29, 2019 3:48 am

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?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Password Check

Post by FourthWorld » Mon Apr 29, 2019 8:30 am

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Password Check

Post by SparkOut » Mon Apr 29, 2019 3:17 pm

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.

Post Reply