Package net.sourceforge.pebble.web.validation

Examples of net.sourceforge.pebble.web.validation.ValidationContext.addError()


        blog.info("Blog entry <a href=\"" + blogEntry.getLocalPermalink() + "\">" + blogEntry.getTitle() + "</a> saved.");
        getModel().put(Constants.BLOG_ENTRY_KEY, blogEntry);
        return new RedirectView(blogEntry.getLocalPermalink());
      } catch (BlogServiceException be) {
        log.error(be.getMessage(), be);
        context.addError(be.getMessage());
        be.printStackTrace();
        return new BlogEntryFormView();
      }
    }
  }
View Full Code Here


      PebbleUserDetails newUserDetails = new PebbleUserDetails(username, password1, name, emailAddress, website, profile, roles, preferences, detailsUpdateable);

      ValidationContext validationContext = new ValidationContext();

      if (newUser && currentUserDetails != null) {
        validationContext.addError("A user with this username already exists");
      } else if (newUser && (username == null || username.trim().length() == 0)) {
        validationContext.addError("Username can't be empty");
      } else if (password1 != null && password1.length() > 0 && !password1.equals(password2)) {
        validationContext.addError("Passwords must match");
      } else {
View Full Code Here

      ValidationContext validationContext = new ValidationContext();

      if (newUser && currentUserDetails != null) {
        validationContext.addError("A user with this username already exists");
      } else if (newUser && (username == null || username.trim().length() == 0)) {
        validationContext.addError("Username can't be empty");
      } else if (password1 != null && password1.length() > 0 && !password1.equals(password2)) {
        validationContext.addError("Passwords must match");
      } else {

        if (newUser) {
View Full Code Here

      if (newUser && currentUserDetails != null) {
        validationContext.addError("A user with this username already exists");
      } else if (newUser && (username == null || username.trim().length() == 0)) {
        validationContext.addError("Username can't be empty");
      } else if (password1 != null && password1.length() > 0 && !password1.equals(password2)) {
        validationContext.addError("Passwords must match");
      } else {

        if (newUser) {
          try {
            realm.createUser(newUserDetails);
View Full Code Here

        if (newUser) {
          try {
            realm.createUser(newUserDetails);
          } catch (SecurityRealmException sre) {
            validationContext.addError(sre.getMessage());
          }
        } else {
          realm.updateUser(newUserDetails);
          if (password1 != null && password1.length() > 0) {
            realm.changePassword(username, password1);
View Full Code Here

        String realm = PebbleContext.getInstance().getConfiguration().getUrl();
        String openIdUrl = openIDConsumer.beginConsumption(request, claimedIdentity, returnToUrl, realm);
        return new RedirectView(openIdUrl);
      } catch (OpenIDConsumerException oice) {
        log.error("Error adding OpenID", oice);
        validationContext.addError("Error adding OpenID " + oice.getMessage());
      }

    } else {

      try {
View Full Code Here

        OpenIDAuthenticationToken token = openIDConsumer.endConsumption(request);
        if (token.getStatus() == OpenIDAuthenticationStatus.SUCCESS) {
          // Check that the OpenID isn't already mapped
          String openId = token.getIdentityUrl();
          if (securityRealm.getUserForOpenId(openId) != null) {
            validationContext.addError("The OpenID supplied is already mapped to a user.");
          } else {
            // Add it
            securityRealm.addOpenIdToUser(userDetails, openId);
            return new RedirectView(blog.getUrl() + "/editUserPreferences.secureaction");
          }
View Full Code Here

            // Add it
            securityRealm.addOpenIdToUser(userDetails, openId);
            return new RedirectView(blog.getUrl() + "/editUserPreferences.secureaction");
          }
        } else {
          validationContext.addError(StringUtils.transformHTML(token.getMessage()));
        }

      } catch (OpenIDConsumerException oice) {
        log.error("Error in consumer", oice);
        validationContext.addError("Error adding OpenID " + oice.getMessage());
View Full Code Here

          validationContext.addError(StringUtils.transformHTML(token.getMessage()));
        }

      } catch (OpenIDConsumerException oice) {
        log.error("Error in consumer", oice);
        validationContext.addError("Error adding OpenID " + oice.getMessage());
      } catch (SecurityRealmException sre) {
        log.error("Error looking up user by security realm", sre);
      }
    }
View Full Code Here

      }

      ValidationContext validationContext = new ValidationContext();

      if (password1 == null || password1.length() == 0) {
        validationContext.addError("Password can not be empty");
      } else if (!password1.equals(password2)) {
        validationContext.addError("Passwords do not match");
      }

      if (!validationContext.hasErrors()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.