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

こ雲淡風輕ζ 提交于 2019-12-06 05:56:16

问题


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.


回答1:


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

dscl . -authonly <username> ""



回答2:


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.



来源:https://stackoverflow.com/questions/7081417/how-do-i-determine-if-a-user-has-a-password-set-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!