简体   繁体   中英

How do I determine if a user has a password set on Mac?

I need to determine if a user has a non-empty password set on Mac. Anything will work: a command line call, AppleScript, Carbon, Cocoa, etc.

I want to inform the user whether or not they have a password set.

I've found the answer to my question. Thanks anyway.

dscl . -authonly <username> ""

If you are performing an action that would require any user to enter a password, then you should allow them the opportunity to verify that password even if it is empty, and then handle the behavior if they decide not to allow that action accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM