コード例 #1
0
 /** Validates the registration when the confirmation code comes through query string. */
 @PostConstruct
 public void load() {
   if (this.code != null && !this.code.isEmpty()) {
     FacesContext context = FacesContext.getCurrentInstance();
     ResourceBundleHelper bundle = new ResourceBundleHelper();
     this.userAccount = userAccountBsn.confirmUser(this.code);
     if (this.userAccount != null) {
       this.validated = Boolean.TRUE;
     } else {
       this.validated = Boolean.FALSE;
       context.addMessage(
           this.informedCode,
           new FacesMessage(FacesMessage.SEVERITY_WARN, bundle.getMessage("warnCode0003"), ""));
     }
   }
 }
コード例 #2
0
  /** Validates the registration when the confirmation code is manually informed. */
  public String confirmUser() {
    if (this.informedCode != null && !this.informedCode.isEmpty()) {
      this.userAccount = userAccountBsn.confirmUser(this.informedCode);
      if (this.userAccount != null) {
        this.validated = Boolean.TRUE;
      } else {
        this.validated = Boolean.FALSE;
      }

      FacesContext context = FacesContext.getCurrentInstance();
      ResourceBundleHelper bundle = new ResourceBundleHelper();
      if (!this.validated) {
        context.addMessage(
            this.informedCode,
            new FacesMessage(FacesMessage.SEVERITY_WARN, bundle.getMessage("warnCode0003"), ""));
      }
    }
    return "registration_confirmation";
  }