Applescript to verify user...


I am looking for a way to use applescript to verify the users true identity. For example I am running a computer lab at a high school and each student has their own username and password. The purpose of this was to ensure their classwork and what is safe and secure from other students in the same class.

For example if the class is doing an assignment and one student has completed his work, I do not want another student to sit at the terminal and steal their work.

My idea for a work around is perhaps having an applescript popup maybe after an alotted non -use time and have a dialog box ask them to enter their username and pass. And if they entered the wrong name give them maybe one more chance before forcing the computer to sleep. And then finally having the system send a notification to my computer stating there was a problem at this terminal, I was thinking through appletalk/email.whatever.

I wanted to use applescript and not the system software to do a prompt after a screensaver because I wanted to show the students what is possible and I do not want to have their work disappear like with a shutdown.

So what I need is:

  1. a dialog box to appear that allows the user to verify who they are
  2. if the user is incorrect have the machine shut down and notify a delegated administrator.

Anyone have any ideas on how to do a user verification with applescript?


There’s several problems with your idea.

  1. you can’t retrieve the current users password and you need that to compare against the password entered
  2. an applescript cannot block access to all the other programs so essentially your user can just ignore the request for their username and password and continue working with the computer.
  3. even if you could do #1 and #2, when you try to shut down the computer the systems makes sure any unsaved changes in open documents are saved, so it pauses the shutdown process and asks the user if they want to save their changes… at this point the user can cancel the shutdown process.

As such I don’t think you can overcome all 3 of the above things so I don’t see applescript as being a viable option to do what you want. Unfortunately I can’t think of any other solutions for your question either.

Perhaps, instead of barring them from all applications, after a wait, the script could save all open documents, close all applications and restart the computer. Presumably, the restart will force the student to re-enter their username/password.

At my school, they have Macs that have a network with wireless accounts. They do not need to install anything onto the Mac, they just need the Mac with the right configurations and they can click on “Other…” on the login window. This seems to be the most secure and cannot be abused without stealing passwords. Remember: No extra software; just a few network settings. I don’t know much, and I can’t ask simply because its summer. It was a bit complicated, but it would be a dream [for me] to have this in my own house, so no one looses their data from breaking a computer.