Hi Guys,
i’ve been an avid reader of these forums for my scripting needs, but this time by searching foo has let me down.
Please help with the below.
I’ve created an applescript to check ask the user for a password, when entered it makes sure the password is more than 8 characters & asks for them to verify.
The next step is to make sure the password also contains 2 of the 3: capital letter, number & special character (i.e @!)
not sure how to proceed, i’ve tried creating a list & comparing but that’s failing for me… any help would be greatly appreciated… especially by 1pm est
set userPassword1 to ""
set userPassword2 to ""
tell application "Finder"
repeat while userPassword1 = ""
display dialog "Please enter your password below." & "
The password needs to be a minimum of 8 characters in length & must contain at least 2 of the following 3. A capital letter, number or special character." buttons {"OK"} default answer "" with hidden answer
set userPassword1 to text returned of result
if length of userPassword1 < 8 then
display dialog "Password needs to be a minimum of 8 characters." buttons {"OK"} default answer "" with hidden answer
set userPassword1 to text returned of result
else
exit repeat
end if
end repeat
end tell
tell application "Finder"
display dialog "Please verify your password below." buttons {"OK"} default answer "" with hidden answer
set userPassword2 to text returned of result
considering case
repeat while userPassword2 is not equal to userPassword1
display dialog "Passwords do not match, please re-enter your password below." buttons {"OK"} default answer "" with hidden answer
set userPassword2 to text returned of result
end repeat
end considering
-- for testing only
display dialog userPassword1 & userPassword2
end tell