I have a script that runs a shell script with admin privileges. I know how to automatically apply a stored password to this. I also have a routine that checks the stored password on entry as below:
on checkAdminPassword()
do shell script "sudo -k"
delay 1
try
do shell script "sudo -v" password adminPasswd with administrator privileges
on error
return false
end try
return true
end checkAdminPassword
This works fine when the use enters the correct password. If the password is incorrect, the routine does return false. The problem is that the system password dialog appears asking for the password. Is there a way to suppress this password request when the password is incorrect? Is there another way to do this that will not call the dialog when the password is wrong?
Dee