示例#1
0
        private string ValidateNewUser(CachedUser user)
        {
            if (user == null || !Permissions.CanAddUser(user.RoleId))
            {
                return("Insufficient Permissions.");
            }

            if (string.IsNullOrWhiteSpace(UserEmailInput.Text))
            {
                return("Email cannot be empty.");
            }

            if (string.IsNullOrWhiteSpace(UserPasswordInput.Text))
            {
                return("Password cannot be empty.");
            }

            if (!UserPasswordInput.Text.Equals(UserConfirmInput.Text))
            {
                return("Passwords do not match.");
            }

            if (_userDal.GetByEmail(UserEmailInput.Text) != null)
            {
                return("User already exists.");
            }

            return(string.Empty);
        }