Package com.twmacinta.util

Examples of com.twmacinta.util.MD5.Update()


  private User login(org.hibernate.Session session, HttpServletRequest request, HttpServletResponse response, String username, String password, boolean internal)
      throws SimpleMessageException {
    username = username.toLowerCase();
    User user = UserHelper.getUser(session, username);
    MD5 md5 = new MD5();
    md5.Update(password);
    String passwordHash = md5.asHex();
    if (user != null && isAccountValidated(user) && ((internal && password.equals(user.getPasswordHash())) || user.getPasswordHash().equals(passwordHash))) {
      Cookie userCookie = new Cookie("user", user.getUsername());
      userCookie.setPath("/");
      userCookie.setMaxAge(COOKIE_TIMEOUT);
View Full Code Here


        User newUser = new User();
        newUser.setUsername(inUser.getUsername().toLowerCase());
        if (password != null && !"".equals(password)) {
          MD5 md5 = new MD5();
          md5.Update(password);
          newUser.setPasswordHash(md5.asHex());
        }
        if (authUser != null && authUser.isAdministrator()) {
          newUser.setAdministrator(inUser.isAdministrator());
        }
View Full Code Here

          }
        } else if (authUser == null && !isAccountValidated(newUser)) {
          // send user a validation email, where, upon clicking the link, their account will be validated
          // the validation code in the URL will simply be a hash of their email address
          MD5 md5 = new MD5();
          md5.Update(newUser.getEmail());
          md5.Update(newUser.getPasswordHash());

          String portStr = "";
          if (getThreadLocalRequest().getLocalPort() != 80) {
            portStr = ":" + getThreadLocalRequest().getLocalPort();
View Full Code Here

        } else if (authUser == null && !isAccountValidated(newUser)) {
          // send user a validation email, where, upon clicking the link, their account will be validated
          // the validation code in the URL will simply be a hash of their email address
          MD5 md5 = new MD5();
          md5.Update(newUser.getEmail());
          md5.Update(newUser.getPasswordHash());

          String portStr = "";
          if (getThreadLocalRequest().getLocalPort() != 80) {
            portStr = ":" + getThreadLocalRequest().getLocalPort();
          }
View Full Code Here

        // -authentication
        // -we are the administrator
        // -we are editing our own account
        if (password != null && !"".equals(password)) {
          MD5 md5 = new MD5();
          md5.Update(password);
          dbUser.setPasswordHash(md5.asHex());
        }
        if (authUser.isAdministrator()) {
          dbUser.setAdministrator(inUser.isAdministrator());
        }
View Full Code Here

    Transaction tx = session.get().beginTransaction();
    try {
      User user = UserHelper.getUser(session.get(), username);
      if (user != null && !user.isValidated()) {
        MD5 md5 = new MD5();
        md5.Update(user.getEmail());
        md5.Update(user.getPasswordHash());
        if (validationCode.equals(md5.asHex())) {
          // validation successful
          user.setValidated(true);
          login(session.get(), getThreadLocalRequest(), getThreadLocalResponse(), username, user.getPasswordHash(), true);
View Full Code Here

    try {
      User user = UserHelper.getUser(session.get(), username);
      if (user != null && !user.isValidated()) {
        MD5 md5 = new MD5();
        md5.Update(user.getEmail());
        md5.Update(user.getPasswordHash());
        if (validationCode.equals(md5.asHex())) {
          // validation successful
          user.setValidated(true);
          login(session.get(), getThreadLocalRequest(), getThreadLocalResponse(), username, user.getPasswordHash(), true);
          tx.commit();
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.