Fix password validation

Makes the validate password function actually work properly. Also makes the create user javascript in line with the function.
This is another candidate for the refactoring of lookup tables to use the convention that is compatible with `convert_to_id` and `convert_from_id` (see issue #292)