added tests for user validation and added the code for validation