public ValidationInfo ValidateRegToken(string registrationToken)
        {
            var errorMessages = new LinkedList <ErrorMessage>();

            if (HashingUtil.IsTokenExpired(registrationToken, hoursToExpire: 336))
            {
                errorMessages.AddLast(Errors.ExpiredRegistrationToken());
            }

            return(new ValidationInfo(errorMessages));
        }
        public ValidationInfo ValidateFinishReg(User userForUpdate, RegCredentials regCredentials)
        {
            var errorMessages = new List <ErrorMessage>();

            if (userForUpdate.RegistrationToken == null)
            {
                errorMessages.Add(Errors.UserAlreadyRegistered());
            }

            if (userForUpdate.RegistrationToken != regCredentials.RegistrationToken)
            {
                errorMessages.Add(Errors.InvalidRegistrationToken());
            }

            if (userForUpdate.RegistrationToken != null && HashingUtil.IsTokenExpired(userForUpdate.RegistrationToken, hoursToExpire: 336))
            {
                errorMessages.Add(Errors.ExpiredRegistrationToken());
            }

            return(new ValidationInfo(errorMessages));
        }