Prevent keyboard layout changes from locking you out of your Mac
If you use multiple input layouts with your Mac, use screensaver passwords with caution.
A relatively long-standing issue exists in OS X that could, given the oversight on toggling certain system settings, result in the inability to access your Mac if you use multiple input methods.
One of the security features in OS X is to require a password when waking the system or deactivating the screensaver. This feature, set in the Security system preferences, can be timed such that it activates immediately or after a delay of up to 4 hours once the screensaver or Sleep mode is activated. As with the log-in screen, this will require you supply your account's credentials in order to continue using your system.
For the most part, this feature works flawlessly, but sometimes, both it and the standard log-in screen may be adversely affected if you have more than one nonstandard input method (keyboard layout) configured for your system (even nonstandard layout alternatives like Dvorak).
As with all passwords, the characters for it will be supplied by what is available through the system's current keyboard layout, which by default should match your keyboard's physical keys (e.g., US English). If you have changed this layout in the OS X "Keyboard" system preferences, then the inputs may map to alternative characters, and result in an inability to supply the ones needed for your password.
In some cases, the layouts used will simply rearrange some characters so you will have to use alternative keys or modifiers to access them for your password. Other times the characters may simply not be available, such as the difference between the layouts for US English and Asian languages.
If your layout is set to one where characters for your password are not available, then if the screensaver or sleep password activates you will not be able to supply your password. As a result, any attempt will have the system refuse entry back to your system, and require a hard-reset of the computer in order to reload the log-in window. In addition, if the keyboard layout sticks at the log-in window, then you will not be able to supply your password there, either.
Fortunately Apple does have a couple of settings you can enable to help manage such input problems at the log-in window or at the screensaver password prompt. The first is the log-in window input menu, which can be enabled by going to the Users & Groups system preferences, and then clicking the "Login Options" button. Unlock the system preferences, and you should then be able to check the box to show the input menu in the log-in window. This option will allow you to change the keyboard layout at the log-in window.
The second option is to enable the Input menu in your account's menu bar, which will make it available during the screensaver password. With this menu available, you should be able to click it and choose an appropriate keyboard layout to use for entering your password. If you have forgotten to do this and are stuck at the password prompt, then you will have to restart your computer to get back to the log-in window.
Therefore, if you use multiple keyboard layouts with your system, then be sure to enable the layout menus at both the log-in window and within your account, to ensure you can properly switch to a required one if needed.