Password Verification

sgoetz
Contributor

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!

1 ACCEPTED SOLUTION

alexjdale
Valued Contributor III

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

View solution in original post

3 REPLIES 3

alexjdale
Valued Contributor III

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

sgoetz
Contributor

Thank you very much!!!

IT-Chris
New Contributor III

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