Re: adding authentication...
Re: adding authentication...
- Subject: Re: adding authentication...
- From: Gnarlodious <email@hidden>
- Date: Mon, 17 May 2004 17:54:36 -0600
Entity Graff spoke thus:
>
What you need to do is to bring up a dialog window which asks for the
>
password, then pass that password to the command. Here's how I would
>
do it in a regular ScriptEditor-created application:
>
----
>
display dialog "Enter in your password" default answer "" buttons
>
{"Cancel", "Erase Files"} default button "Erase Files"
>
set theReply to result
>
if button returned of theReply is "Erase Files" then
>
set thePassword to text returned of theReply
>
do shell script "sudo rm -r /somepath/somefile" password thePassword
>
with administrator privileges
>
end if
>
----
>
>
- Ken
But keep in mind 2 things for security.
At the end of your script you should say:
set thePassword to "" -- erase password
do shell script "sudo -k" -- deauthenticate
For a general distribution script, you'll find that people dislike typing
their password into a field where the typing shows. The shell's
authentication dialog "please enter your password" is better. Much more
secure.
--
Change your sidebar's "Computer" icon:
http://www.Gnarlodious.com/Mac/AppleScript/Finder-ChangeComputerIcon.sit
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.