code: public E registerUser(E user, HttpServletRequest request) throws Exception {
  
          String email = user.getEmail();
  
          // check if a user with the email already exists
          E existingUser = dao.findByEmail(email);
  
          if (existingUser != null) {
              final String errorMessage = "User with eMail '" + email + "' already exists.";
              LOG.info(errorMessage);
              throw new Exception(errorMessage);
          }
  
          user = (E) this.persistNewUser(user, true);
  
          // create a token for the user and send an email with an "activation" link
          registrationTokenService.sendRegistrationActivationMail(request, user);
  
          return user;
      }
docs: Registers a new user. Initially, the user will be inactive. An email with
  an activation link will be sent to the user.
  
  @param user    A user with an UNencrypted password (!)
  @param request
  @throws Exception