Added a password check function

We need to do the same check on the server-side.