Created validation code for registering a new user