I want to add user authentication in my applescript to perform some task. If the username and password is correct then only the next task should happen. How to do this using applescript?
A:
You haven't really said how much security you want.
The most basic of solutions:
display dialog "Enter username:" default answer ""
set enteredUsername to text returned of result
display dialog "Enter password:" default answer ""
set enteredPassword to text returned of result
if enteredUsername is "CORRECTUSERNAME"
if enteredPassword is "CORRECTPASSWORD"
-- do something
end if
end if
Save it as a read-only script and it'll prevent casual users from looking at the contents of the script, but this is not really secure at all if someone really wants to break through your protection.
macatomy
2010-03-06 01:18:19
No, I don't want to check username and password like this. I want to check the entered username and password by user against the current user's username and passwd from system.
Shakti
2010-03-06 11:47:18