views:

437

answers:

1

Is there a built in username/password dialog box in Cocoa? I don't want to reinvent this if there's a standard way of doing it, but after googling, I came up with nothing.

I often see that lock image with the application image superimposed on it, so I thought there might be something.

+4  A: 

There is NSSecureTextField, a control (NSTextField subclass) for entering secure text (it shows • instead of the typed letters and doesn't allow copying to a non-secure text field), but there is no standard authentication dialog in Cocoa for arbitrary use.

The Authorization Services framework will display the standard dialog when needed (i.e. in response to a request to the framework), but I don't believe you can co-opt this dialog for your own purposes (nor should you; it would be a serious mistake to let users think they were authorizing a privileged action according the understood meaning of the dialog when you were using the dialog with a different intent).

Barry Wark