logic for password and username checking