Finish the login function and fix a bug for password criteria