Skip to main content
Solved

Password Verification

  • June 16, 2015
  • 3 replies
  • 19 views

Forum|alt.badge.img+7

Is there a way to verify a user enters the correct password and if they don't prompt for it again. I am making a Apple Script to enable FileVault for the logged in user. So I have a AppleScript that pop-ups a dialog box asking the user for their password with hidden text and I store that to a variable. I need to somehow to check if the password they entered their is correct and if its not, prompt the user to try again.

Thanks!

Best answer by alexjdale

Here is how I check with dscl (in bash):

passDSCLCheck=`dscl /Local/Default authonly $User $Pass; echo $?`
if [ "$passDSCLCheck" -eq 0 ]; then
    echo "Password OK for $User"
fi

3 replies

Forum|alt.badge.img+18
  • Contributor
  • Answer
  • June 16, 2015

Here is how I check with dscl (in bash):

passDSCLCheck=`dscl /Local/Default authonly $User $Pass; echo $?`
if [ "$passDSCLCheck" -eq 0 ]; then
    echo "Password OK for $User"
fi

Forum|alt.badge.img+7
  • Author
  • Contributor
  • June 16, 2015

Thank you very much!!!


Forum|alt.badge.img+5
  • Contributor
  • May 13, 2019

I wonder if there is a way to validate a AD password password ok or
password not ok

I need to have a script run bases on if the password is correct and if the type password is not correct then to fail the script