added checks to user model, created tests for the checks