Exemple #1
0
  public User insertUser(User user) throws InsertException {
    try {
      String sha1Password = convertPassword(user.getPassword().getBytes());
      user.setPassword(sha1Password);
    } catch (Exception e) {
      throw new InsertException(e.getMessage());
    }

    User expRet = rep.insertUser(user);
    return expRet;
  }
Exemple #2
0
  public User requestAccess(String fullName, String username, String password, String mailAddress)
      throws InsertException {
    User user = new User();
    user.setFullName(fullName);
    user.setLoginName(username);
    user.setPassword(password);
    user.setUserMail(mailAddress);

    try {
      String sha1Password = convertPassword(user.getPassword().getBytes());
      user.setPassword(sha1Password);
      user.setType(UserType.NEW);
      rep.insertUser(user);

      MailService ms = new MailService();
      ms.sendUserRequest(user);

    } catch (Exception e) {
      throw new InsertException(e.getMessage());
    }

    return user;
  }