added validation

added validation for required filed and invalid credentials.