homebysix / jss-filevault-reissue

A framework for re-escrowing missing or invalid FileVault keys with Jamf Pro.
Apache License 2.0
186 stars 56 forks source link

Keyboard input in different languages will revert to US keyboard #22

Closed brandobot closed 4 years ago

brandobot commented 5 years ago

If a user is using a different keyboard input such as French or Spanish, the launchctl asuser method of invoking the password prompts will switch the user's keyboard to English.

homebysix commented 5 years ago

Interesting. Do you know of any solution to this? An environment variable maybe?

brandobot commented 4 years ago

Did not find a resolution to this yet. We completed our project to re-issue the fv keys with the help of your code (thanks!!!) and were okay with a 5% failure rate due to different keyboard languages being used.

brandobot commented 4 years ago

Finally took some time to look into this issue. I found that running the password prompt osascript command with "sudo" reverted my keyboard input to US.

Changing it to "USER_PASS="$(/bin/launchctl "$L_METHOD" "$L_ID" sudo -iu $CURRENT_USER /usr/bin/osascript -e 'display dialog "Please enter the password you use to log in to your Mac:" default answer "" with title "'"${PROMPT_TITLE//\"/\\"}"'" giving up after 86400 with text buttons {"OK"} default button 1 with hidden answer with icon file "'"${LOGO_POSIX//\"/\\"}"'"' -e 'return text returned of result')"" will retain the keyboard layout set by the user.