A great piece of code. Just a couple of small additions:
pressing the 'delete' key counts as a letter, rather than a eraser. I put the following string in there:
password = password(1:end-1);
It's basically copying the backspace code, but it kind of makes it look a bit prettier, though don't think it's a full functionality.
Also, clicking the 'cancel' button basically just proceeds with the function. I used close(fig) rather than uiresume(fig) to close the dlg and disable access to the GUI.