Ejemplo n.º 1
0
 private boolean _jspx_meth_fmt_message_2(PageContext _jspx_page_context) throws Throwable {
   PageContext pageContext = _jspx_page_context;
   JspWriter out = _jspx_page_context.getOut();
   //  fmt:message
   org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_message_2 =
       (org.apache.taglibs.standard.tag.rt.fmt.MessageTag)
           _jspx_tagPool_fmt_message_key.get(
               org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class);
   _jspx_th_fmt_message_2.setPageContext(_jspx_page_context);
   _jspx_th_fmt_message_2.setParent(null);
   _jspx_th_fmt_message_2.setKey("system.emailtest.no_host");
   int _jspx_eval_fmt_message_2 = _jspx_th_fmt_message_2.doStartTag();
   if (_jspx_eval_fmt_message_2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
     if (_jspx_eval_fmt_message_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
       out = _jspx_page_context.pushBody();
       _jspx_th_fmt_message_2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
       _jspx_th_fmt_message_2.doInitBody();
     }
     do {
       out.write("\n\t\t\t\t    ");
       if (_jspx_meth_fmt_param_0(_jspx_th_fmt_message_2, _jspx_page_context)) return true;
       out.write("\n\t\t\t\t    ");
       if (_jspx_meth_fmt_param_1(_jspx_th_fmt_message_2, _jspx_page_context)) return true;
       out.write("\n\t\t\t\t");
       int evalDoAfterBody = _jspx_th_fmt_message_2.doAfterBody();
       if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break;
     } while (true);
     if (_jspx_eval_fmt_message_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
       out = _jspx_page_context.popBody();
   }
   if (_jspx_th_fmt_message_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
     _jspx_tagPool_fmt_message_key.reuse(_jspx_th_fmt_message_2);
     return true;
   }
   _jspx_tagPool_fmt_message_key.reuse(_jspx_th_fmt_message_2);
   return false;
 }
Ejemplo n.º 2
0
 private boolean _jspx_meth_fmt_message_20(PageContext _jspx_page_context) throws Throwable {
   PageContext pageContext = _jspx_page_context;
   JspWriter out = _jspx_page_context.getOut();
   //  fmt:message
   org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_message_20 =
       (org.apache.taglibs.standard.tag.rt.fmt.MessageTag)
           _jspx_tagPool_fmt_message_key_nobody.get(
               org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class);
   _jspx_th_fmt_message_20.setPageContext(_jspx_page_context);
   _jspx_th_fmt_message_20.setParent(null);
   _jspx_th_fmt_message_20.setKey("registration.sign.up.create_account");
   int _jspx_eval_fmt_message_20 = _jspx_th_fmt_message_20.doStartTag();
   if (_jspx_th_fmt_message_20.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
     _jspx_tagPool_fmt_message_key_nobody.reuse(_jspx_th_fmt_message_20);
     return true;
   }
   _jspx_tagPool_fmt_message_key_nobody.reuse(_jspx_th_fmt_message_20);
   return false;
 }
Ejemplo n.º 3
0
 private boolean _jspx_meth_fmt_message_14(PageContext _jspx_page_context) throws Throwable {
   PageContext pageContext = _jspx_page_context;
   JspWriter out = _jspx_page_context.getOut();
   //  fmt:message
   org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_message_14 =
       (org.apache.taglibs.standard.tag.rt.fmt.MessageTag)
           _jspx_tagPool_fmt_message_key_nobody.get(
               org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class);
   _jspx_th_fmt_message_14.setPageContext(_jspx_page_context);
   _jspx_th_fmt_message_14.setParent(null);
   _jspx_th_fmt_message_14.setKey("system.emailtest.cancel");
   int _jspx_eval_fmt_message_14 = _jspx_th_fmt_message_14.doStartTag();
   if (_jspx_th_fmt_message_14.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
     _jspx_tagPool_fmt_message_key_nobody.reuse(_jspx_th_fmt_message_14);
     return true;
   }
   _jspx_tagPool_fmt_message_key_nobody.reuse(_jspx_th_fmt_message_14);
   return false;
 }
Ejemplo n.º 4
0
 private boolean _jspx_meth_c_set_1(PageContext _jspx_page_context) throws Throwable {
   PageContext pageContext = _jspx_page_context;
   JspWriter out = _jspx_page_context.getOut();
   //  c:set
   org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_set_1 =
       (org.apache.taglibs.standard.tag.rt.core.SetTag)
           _jspx_tagPool_c_set_var_value_nobody.get(
               org.apache.taglibs.standard.tag.rt.core.SetTag.class);
   _jspx_th_c_set_1.setPageContext(_jspx_page_context);
   _jspx_th_c_set_1.setParent(null);
   _jspx_th_c_set_1.setVar("errors");
   _jspx_th_c_set_1.setValue(new String("${errors}"));
   int _jspx_eval_c_set_1 = _jspx_th_c_set_1.doStartTag();
   if (_jspx_th_c_set_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
     _jspx_tagPool_c_set_var_value_nobody.reuse(_jspx_th_c_set_1);
     return true;
   }
   _jspx_tagPool_c_set_var_value_nobody.reuse(_jspx_th_c_set_1);
   return false;
 }
Ejemplo n.º 5
0
 private boolean _jspx_meth_fmt_param_1(
     javax.servlet.jsp.tagext.JspTag _jspx_th_fmt_message_2, PageContext _jspx_page_context)
     throws Throwable {
   PageContext pageContext = _jspx_page_context;
   JspWriter out = _jspx_page_context.getOut();
   //  fmt:param
   org.apache.taglibs.standard.tag.rt.fmt.ParamTag _jspx_th_fmt_param_1 =
       (org.apache.taglibs.standard.tag.rt.fmt.ParamTag)
           _jspx_tagPool_fmt_param_value_nobody.get(
               org.apache.taglibs.standard.tag.rt.fmt.ParamTag.class);
   _jspx_th_fmt_param_1.setPageContext(_jspx_page_context);
   _jspx_th_fmt_param_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_fmt_message_2);
   _jspx_th_fmt_param_1.setValue(new String("</a>"));
   int _jspx_eval_fmt_param_1 = _jspx_th_fmt_param_1.doStartTag();
   if (_jspx_th_fmt_param_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
     _jspx_tagPool_fmt_param_value_nobody.reuse(_jspx_th_fmt_param_1);
     return true;
   }
   _jspx_tagPool_fmt_param_value_nobody.reuse(_jspx_th_fmt_param_1);
   return false;
 }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");
      pageContext =
          _jspxFactory.getPageContext(this, request, response, "error.jsp", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n\r\n\r\n\r\n");

      PresencePlugin plugin =
          (PresencePlugin) XMPPServer.getInstance().getPluginManager().getPlugin("presence");

      // Get parameters
      boolean save = request.getParameter("save") != null;
      boolean success = request.getParameter("success") != null;
      boolean presencePublic = ParamUtils.getBooleanParameter(request, "presencePublic");
      String unavailableStatus =
          ParamUtils.getParameter(request, "presenceUnavailableStatus", false);
      if (unavailableStatus == null) {
        unavailableStatus = plugin.getUnavailableStatus();
      }

      // Handle a save
      if (save) {
        plugin.setPresencePublic(presencePublic);
        plugin.setUnavailableStatus(unavailableStatus);
        response.sendRedirect("presence-service.jsp?success=true");
        return;
      }

      presencePublic = plugin.isPresencePublic();

      out.write(
          "\r\n\r\n<html>\r\n    <head>\r\n        <title>Presence Service</title>\r\n        <meta name=\"pageID\" content=\"presence-service\"/>\r\n    </head>\r\n    <body>\r\n\r\n<div class=\"information\">\r\n    ");

      String serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
      int port = JiveGlobals.getXMLProperty("adminConsole.port", -1);
      int securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", -1);
      boolean secureOnly = (port == -1);

      out.write("\r\n\r\n    Presence Service URL:<br>\r\n    <tt>");
      out.print(secureOnly ? "https" : "http");
      out.write(':');
      out.write('/');
      out.write('/');
      out.print(serverName);
      out.write(':');
      out.print(secureOnly ? securePort : port);
      out.write("/plugins/presence/status</tt>\r\n    <br><br>\r\n    Example:<br>\r\n    <tt>");
      out.print(secureOnly ? "https" : "http");
      out.write(':');
      out.write('/');
      out.write('/');
      out.print(serverName);
      out.write(':');
      out.print(secureOnly ? securePort : port);
      out.write("/plugins/presence/status?jid=admin@");
      out.print(serverName);
      out.write(
          "</tt>  \r\n\r\n\r\n</div>\r\n\r\n<p>\r\nUse the form below to configure user presence visibility. By default, user\r\npresence should only be visible to those users that are authorized.<br>\r\n</p>\r\n\r\n");
      if (success) {
        out.write(
            "\r\n\r\n    <div class=\"jive-success\">\r\n    <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n    <tbody>\r\n        <tr><td class=\"jive-icon\"><img src=\"images/success-16x16.gif\" width=\"16\" height=\"16\" border=\"0\"></td>\r\n        <td class=\"jive-icon-label\">\r\n            Presence service properties edited successfully.\r\n        </td></tr>\r\n    </tbody>\r\n    </table>\r\n    </div><br>\r\n");
      }
      out.write(
          "\r\n\r\n<form action=\"presence-service.jsp?save\" method=\"post\">\r\n\r\n<fieldset>\r\n    <legend>Presence visibility</legend>\r\n    <div>\r\n    <p>\r\n    For security reasons, users control which users are authorized to see their presence. However,\r\n    it is posible to configure the service so that anyone has access to all presence information.\r\n    Use this option with caution.\r\n    </p>\r\n    <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n    <tbody>\r\n        <tr>\r\n            <td width=\"1%\">\r\n            <input type=\"radio\" name=\"presencePublic\" value=\"true\" id=\"rb01\"\r\n             ");
      out.print(((presencePublic) ? "checked" : ""));
      out.write(
          ">\r\n            </td>\r\n            <td width=\"99%\">\r\n                <label for=\"rb01\"><b>Anyone</b> - Anyone may get presence information.</label>\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <td width=\"1%\">\r\n            <input type=\"radio\" name=\"presencePublic\" value=\"false\" id=\"rb02\"\r\n             ");
      out.print(((!presencePublic) ? "checked" : ""));
      out.write(
          ">\r\n            </td>\r\n            <td width=\"99%\">\r\n                <label for=\"rb02\"><b>Subscribed</b> - Presence information is only visibile to authorized users.</label>\r\n            </td>\r\n        </tr>\r\n    </tbody>\r\n    </table>\r\n    </div>\r\n</fieldset>\r\n\r\n<br>\r\n    \r\n<fieldset>\r\n    <legend>Plain Text 'Unavailable' Status Message</legend>\r\n    <div>\r\n    <p>\r\n    In &quot;text&quot; mode the status message for unavailable users is &quot;Unavailable&quot;\r\n    by default. It is possible to change the unavailable status message by setting this property.\r\n    </p>\r\n    <p>\r\n        <input type=\"text\" name=\"presenceUnavailableStatus\" value=\"");
      out.print(unavailableStatus);
      out.write(
          "\">\r\n    </p>\r\n    </div>\r\n</fieldset>\r\n\r\n<br><br>\r\n\r\n<input type=\"submit\" value=\"Save Properties\">\r\n</form>\r\n\r\n</body>\r\n</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Ejemplo n.º 7
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n\n\n\n\n\n\n<html>\n<head>\n    <title>");
      if (_jspx_meth_fmt_message_0(_jspx_page_context)) return;
      out.write(
          "</title>\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"/style/global.css\">\n    <style type=\"text/css\">\n        .drop-shadow {\n             font-weight: bold;\n             font-size: 14pt;\n             color: white;\n             text-shadow: black 0.1em 0.1em 0.2em;\n             padding-top: 21px;}\n    </style>\n    <meta name=\"decorator\" content=\"none\"/>\n</head>\n\n");
      org.jivesoftware.util.WebManager webManager = null;
      synchronized (_jspx_page_context) {
        webManager =
            (org.jivesoftware.util.WebManager)
                _jspx_page_context.getAttribute("webManager", PageContext.PAGE_SCOPE);
        if (webManager == null) {
          webManager = new org.jivesoftware.util.WebManager();
          _jspx_page_context.setAttribute("webManager", webManager, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\n');
      java.util.HashMap errors = null;
      synchronized (_jspx_page_context) {
        errors =
            (java.util.HashMap) _jspx_page_context.getAttribute("errors", PageContext.PAGE_SCOPE);
        if (errors == null) {
          errors = new java.util.HashMap();
          _jspx_page_context.setAttribute("errors", errors, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\n');
      webManager.init(request, response, session, application, out);

      boolean create = request.getParameter("create") != null;
      String username = ParamUtils.getParameter(request, "username");
      String name = ParamUtils.getParameter(request, "name");
      String email = ParamUtils.getParameter(request, "email");
      String password = ParamUtils.getParameter(request, "password");
      String passwordConfirm = ParamUtils.getParameter(request, "passwordConfirm");
      String reCaptchaChallenge = ParamUtils.getParameter(request, "recaptcha_challenge_field");
      String reCaptchaResponse = ParamUtils.getParameter(request, "recaptcha_response_field");

      RegistrationPlugin plugin =
          (RegistrationPlugin)
              webManager.getXMPPServer().getPluginManager().getPlugin("registration");
      ReCaptcha reCaptcha = null;
      if (plugin.reCaptchaEnabled()) {
        reCaptcha =
            ReCaptchaFactory.newReCaptcha(
                plugin.getReCaptchaPublicKey(),
                plugin.getReCaptchaPrivateKey(),
                plugin.reCaptchaNoScript());
      }

      // Handle a request to create a user:
      if (create) {
        // Validate
        if (username == null) {
          errors.put("username", "");
        } else {
          try {
            username = username.trim().toLowerCase();
            username = JID.escapeNode(username);
            username = Stringprep.nodeprep(username);
          } catch (StringprepException se) {
            errors.put("username", "");
          }
        }
        if (password == null) {
          errors.put("password", "");
        }
        if (passwordConfirm == null) {
          errors.put("passwordConfirm", "");
        }
        if (password != null && passwordConfirm != null && !password.equals(passwordConfirm)) {
          errors.put("passwordMatch", "");
        }
        if (plugin.reCaptchaEnabled()) {
          ReCaptchaResponse captchaResponse = null;
          try {
            captchaResponse =
                reCaptcha.checkAnswer(
                    request.getRemoteAddr(), reCaptchaChallenge, reCaptchaResponse);
          } catch (Exception e) {
          }
          if (captchaResponse == null || !captchaResponse.isValid()) {
            errors.put("reCaptchaFail", "");
          }
        }

        // do a create if there were no errors
        if (errors.size() == 0) {
          try {
            webManager.getUserManager().createUser(username, password, name, email);

            response.sendRedirect("sign-up.jsp?success=true");
            return;
          } catch (UserAlreadyExistsException e) {
            errors.put("usernameAlreadyExists", "");
          } catch (Exception e) {
            errors.put("general", "");
            Log.error(e);
          }
        }
      }

      out.write(
          "\n\n<body>\n\n<div id=\"jive-header\">\n<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\">\n    <tbody>\n        <tr><td class=\"drop-shadow\">&nbsp;");
      out.print(plugin.getHeader());
      out.write("</td></tr>    \n    </tbody>\n</table>\n</div>\n\n<div id=\"jive-content\">\n\n");
      if (!plugin.webEnabled()) {
        out.write('\n');
        out.write('\n');
        if (_jspx_meth_fmt_message_1(_jspx_page_context)) return;
        out.write('\n');
        out.write('\n');
      } else {
        out.write("\n\n<p>");
        if (_jspx_meth_fmt_message_2(_jspx_page_context)) return;
        out.write("</p>\n\n");
        if (_jspx_meth_c_set_0(_jspx_page_context)) return;
        out.write('\n');
        if (_jspx_meth_c_set_1(_jspx_page_context)) return;
        out.write('\n');
        out.write('\n');
        if (!errors.isEmpty()) {
          out.write(
              "\n\n    <div class=\"jive-error\">\n    <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n    <tbody>\n        <tr>\n            <td class=\"jive-icon\"><img src=\"images/error-16x16.gif\" width=\"16\" height=\"16\" border=\"0\"/></td>\n            <td class=\"jive-icon-label\">\n\n            ");
          if (errors.get("general") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_3(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("username") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_4(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("usernameAlreadyExists") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_5(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("name") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_6(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("email") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_7(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("password") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_8(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("passwordMatch") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_9(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("passwordConfirm") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_10(_jspx_page_context)) return;
            out.write("\n            ");
          } else if (errors.get("reCaptchaFail") != null) {
            out.write("\n                ");
            if (_jspx_meth_fmt_message_11(_jspx_page_context)) return;
            out.write("\n            ");
          }
          out.write(
              "\n            </td>\n        </tr>\n    </tbody>\n    </table>\n    </div>\n    <br>\n\n");
        } else if (request.getParameter("success") != null) {
          out.write(
              "\n\n    <div class=\"jive-success\">\n    <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n    <tbody>\n        <tr>\n            <td class=\"jive-icon\"><img src=\"images/success-16x16.gif\" width=\"16\" height=\"16\" border=\"0\"></td>\n            <td class=\"jive-icon-label\">");
          if (_jspx_meth_fmt_message_12(_jspx_page_context)) return;
          out.write("</td>\n        </tr>\n    </tbody>\n    </table>\n    </div><br>\n\n");
        }
        out.write(
            "\n\n<form name=\"f\" action=\"sign-up.jsp\" method=\"get\">\n\n<div class=\"jive-contentBoxHeader\">");
        if (_jspx_meth_fmt_message_13(_jspx_page_context)) return;
        out.write(
            "</div>\n<div class=\"jive-contentBox\">\n    <div>\n    <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n    <tbody>\n    <tr>\n        <td width=\"1%\" nowrap><label for=\"usernametf\">");
        if (_jspx_meth_fmt_message_14(_jspx_page_context)) return;
        out.write(
            ":</label> *</td>\n        <td width=\"99%\">\n            <input type=\"text\" name=\"username\" size=\"30\" maxlength=\"75\" value=\"");
        out.print(((username != null) ? username : ""));
        out.write(
            "\"\n             id=\"usernametf\" autocomplete=\"off\">\n        </td>\n    </tr>\n    <tr>\n        <td width=\"1%\" nowrap>\n            <label for=\"nametf\">");
        if (_jspx_meth_fmt_message_15(_jspx_page_context)) return;
        out.write(
            ":</label>\n        </td>\n        <td width=\"99%\">\n            <input type=\"text\" name=\"name\" size=\"30\" maxlength=\"75\" value=\"");
        out.print(((name != null) ? name : ""));
        out.write(
            "\"\n             id=\"nametf\">\n        </td>\n    </tr>\n    <tr>\n        <td width=\"1%\" nowrap>\n            <label for=\"emailtf\">");
        if (_jspx_meth_fmt_message_16(_jspx_page_context)) return;
        out.write(
            ":</label></td>\n        <td width=\"99%\">\n            <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"75\" value=\"");
        out.print(((email != null) ? email : ""));
        out.write(
            "\"\n             id=\"emailtf\">\n        </td>\n    </tr>\n    <tr>\n        <td nowrap>\n            <label for=\"passtf\">");
        if (_jspx_meth_fmt_message_17(_jspx_page_context)) return;
        out.write(
            ":</label> *\n        </td>\n        <td width=\"99%\">\n            <input type=\"password\" name=\"password\" value=\"\" size=\"20\" maxlength=\"75\"\n             id=\"passtf\">\n        </td>\n    </tr>\n    <tr>\n        <td width=\"1%\" nowrap>\n            <label for=\"confpasstf\">");
        if (_jspx_meth_fmt_message_18(_jspx_page_context)) return;
        out.write(
            ":</label> *\n        </td>\n        <td width=\"99%\">\n            <input type=\"password\" name=\"passwordConfirm\" value=\"\" size=\"20\" maxlength=\"75\"\n             id=\"confpasstf\">\n        </td>\n    </tr>\n    </tbody>\n    </table>\n    <br>\n    <span class=\"jive-description\">\n    * ");
        if (_jspx_meth_fmt_message_19(_jspx_page_context)) return;
        out.write("\n    </span>\n    </div>\n</div>\n\n");
        if (reCaptcha != null) {
          out.write('\n');
          out.print(reCaptcha.createRecaptchaHtml(null, null, 0));
          out.write('\n');
        }
        out.write("\n<input type=\"submit\" name=\"create\" value=\"");
        if (_jspx_meth_fmt_message_20(_jspx_page_context)) return;
        out.write(
            "\">\n\n</form>\n\n<script language=\"JavaScript\" type=\"text/javascript\">\ndocument.f.username.focus();\n</script>\n\n");
      }
      out.write("\n\n</body>\n</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Ejemplo n.º 8
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");
      pageContext =
          _jspxFactory.getPageContext(this, request, response, "error.jsp", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n\n\n\n\n\n\n\n\n");
      out.write('\n');
      org.jivesoftware.util.WebManager webManager = null;
      synchronized (_jspx_page_context) {
        webManager =
            (org.jivesoftware.util.WebManager)
                _jspx_page_context.getAttribute("webManager", PageContext.PAGE_SCOPE);
        if (webManager == null) {
          webManager = new org.jivesoftware.util.WebManager();
          _jspx_page_context.setAttribute("webManager", webManager, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\n');
      webManager.init(request, response, session, application, out);
      out.write('\n');
      out.write('\n');
      // Get paramters
      boolean doTest = request.getParameter("test") != null;
      boolean cancel = request.getParameter("cancel") != null;
      boolean sent = ParamUtils.getBooleanParameter(request, "sent");
      boolean success = ParamUtils.getBooleanParameter(request, "success");
      String from = ParamUtils.getParameter(request, "from");
      String to = ParamUtils.getParameter(request, "to");
      String subject = ParamUtils.getParameter(request, "subject");
      String body = ParamUtils.getParameter(request, "body");

      // Cancel if requested
      if (cancel) {
        response.sendRedirect("system-email.jsp");
        return;
      }

      // Variable to hold messaging exception, if one occurs
      Exception mex = null;

      // Validate input
      Map<String, String> errors = new HashMap<String, String>();
      if (doTest) {
        if (from == null) {
          errors.put("from", "");
        }
        if (to == null) {
          errors.put("to", "");
        }
        if (subject == null) {
          errors.put("subject", "");
        }
        if (body == null) {
          errors.put("body", "");
        }

        EmailService service = EmailService.getInstance();

        // Validate host - at a minimum, it needs to be set:
        String host = service.getHost();
        if (host == null) {
          errors.put("host", "");
        }

        // if no errors, continue
        if (errors.size() == 0) {
          // Create a message
          MimeMessage message = service.createMimeMessage();
          // Set the date of the message to be the current date
          SimpleDateFormat format =
              new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", java.util.Locale.US);
          format.setTimeZone(JiveGlobals.getTimeZone());
          message.setHeader("Date", format.format(new Date()));

          // Set to and from.
          message.setRecipient(Message.RecipientType.TO, new InternetAddress(to, null));
          message.setFrom(new InternetAddress(from, null));
          message.setSubject(subject);
          message.setText(body);
          // Send the message, wrap in a try/catch:
          try {
            service.sendMessagesImmediately(Collections.singletonList(message));
            // success, so indicate this:
            response.sendRedirect("system-emailtest.jsp?sent=true&success=true");
            return;
          } catch (MessagingException me) {
            me.printStackTrace();
            mex = me;
          }
        }
      }

      // Set var defaults
      Collection<JID> jids = webManager.getXMPPServer().getAdmins();
      User user = null;
      if (!jids.isEmpty()) {
        for (JID jid : jids) {
          if (webManager.getXMPPServer().isLocal(jid)) {
            user = webManager.getUserManager().getUser(jid.getNode());
            if (user.getEmail() != null) {
              break;
            }
          }
        }
      }
      if (from == null) {
        from = user.getEmail();
      }
      if (to == null) {
        to = user.getEmail();
      }
      if (subject == null) {
        subject = "Test email sent via Openfire";
      }
      if (body == null) {
        body = "This is a test message.";
      }

      out.write("\n\n<html>\n    <head>\n        <title>");
      if (_jspx_meth_fmt_message_0(_jspx_page_context)) return;
      out.write(
          "</title>\n        <meta name=\"pageID\" content=\"system-email\"/>\n    </head>\n    <body>\n\n<script language=\"JavaScript\" type=\"text/javascript\">\nvar clicked = false;\nfunction checkClick(el) {\n    if (!clicked) {\n        clicked = true;\n        return true;\n    }\n    return false;\n}\n</script>\n\n<p>\n");
      if (_jspx_meth_fmt_message_1(_jspx_page_context)) return;
      out.write("\n</p>\n\n");
      if (JiveGlobals.getProperty("mail.smtp.host") == null) {
        out.write(
            "\n\n    <div class=\"jive-error\">\n    <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n    <tbody>\n        <tr>\n        \t<td class=\"jive-icon\"><img src=\"images/error-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n\t        <td class=\"jive-icon-label\">\n\t\t        ");
        if (_jspx_meth_fmt_message_2(_jspx_page_context)) return;
        out.write("\n\t        </td>\n        </tr>\n    </tbody>\n    </table>\n    </div>\n\n");
      }
      out.write('\n');
      out.write('\n');
      if (doTest || sent) {
        out.write("\n\n    ");
        if (success) {
          out.write(
              "\n\n        <div class=\"jive-success\">\n        <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n        <tbody>\n            <tr>\n            \t<td class=\"jive-icon\"><img src=\"images/success-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n            \t<td class=\"jive-icon-label\">");
          if (_jspx_meth_fmt_message_3(_jspx_page_context)) return;
          out.write(
              "</td>\n            </tr>\n        </tbody>\n        </table>\n        </div>\n\n    ");
        } else {
          out.write(
              "\n\n        <div class=\"jive-error\">\n        <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n        <tbody>\n            <tr><td class=\"jive-icon\"><img src=\"images/error-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n            <td class=\"jive-icon-label\">\n                ");
          if (_jspx_meth_fmt_message_4(_jspx_page_context)) return;
          out.write("\n                ");
          if (mex != null) {
            out.write("\n                    ");
            if (mex instanceof AuthenticationFailedException) {
              out.write("\n                    \t");
              if (_jspx_meth_fmt_message_5(_jspx_page_context)) return;
              out.write("                        \n                    ");
            } else {
              out.write("\n                        (Message: ");
              out.print(mex.getMessage());
              out.write(")\n                    ");
            }
            out.write("\n                ");
          }
          out.write(
              "\n            </td></tr>\n        </tbody>\n        </table>\n        </div>\n\n    ");
        }
        out.write("\n\n    <br>\n\n");
      }
      out.write(
          "\n\n<form action=\"system-emailtest.jsp\" method=\"post\" name=\"f\" onsubmit=\"return checkClick(this);\">\n\n<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\">\n<tbody>\n    <tr>\n        <td>\n            ");
      if (_jspx_meth_fmt_message_6(_jspx_page_context)) return;
      out.write(":\n        </td>\n        <td>\n            ");
      String host = JiveGlobals.getProperty("mail.smtp.host");
      if (host == null) {

        out.write("\n                <i>");
        if (_jspx_meth_fmt_message_7(_jspx_page_context)) return;
        out.write("</i>\n            ");

      } else {

        out.write("\n                ");
        out.print(host);
        out.write(':');
        out.print(JiveGlobals.getIntProperty("mail.smtp.port", 25));
        out.write("\n\n                ");
        if (JiveGlobals.getBooleanProperty("mail.smtp.ssl", false)) {
          out.write("\n\n                    (");
          if (_jspx_meth_fmt_message_8(_jspx_page_context)) return;
          out.write(")\n\n                ");
        }
        out.write("\n            ");
      }
      out.write("\n        </td>\n    </tr>\n    <tr>\n        <td>\n            ");
      if (_jspx_meth_fmt_message_9(_jspx_page_context)) return;
      out.write(
          ":\n        </td>\n        <td>\n            <input type=\"hidden\" name=\"from\" value=\"");
      out.print(from);
      out.write("\">\n            ");
      out.print(StringUtils.escapeHTMLTags(from));
      out.write(
          "\n            <span class=\"jive-description\">\n            (<a href=\"user-edit-form.jsp?username="******"\">Update Address</a>)\n            </span>\n        </td>\n    </tr>\n    <tr>\n        <td>\n            ");
      if (_jspx_meth_fmt_message_10(_jspx_page_context)) return;
      out.write(
          ":\n        </td>\n        <td>\n            <input type=\"text\" name=\"to\" value=\"");
      out.print(((to != null) ? to : ""));
      out.write(
          "\"\n             size=\"40\" maxlength=\"100\">\n        </td>\n    </tr>\n    <tr>\n        <td>\n            ");
      if (_jspx_meth_fmt_message_11(_jspx_page_context)) return;
      out.write(
          ":\n        </td>\n        <td>\n            <input type=\"text\" name=\"subject\" value=\"");
      out.print(((subject != null) ? subject : ""));
      out.write(
          "\"\n             size=\"40\" maxlength=\"100\">\n        </td>\n    </tr>\n    <tr valign=\"top\">\n        <td>\n            ");
      if (_jspx_meth_fmt_message_12(_jspx_page_context)) return;
      out.write(
          ":\n        </td>\n        <td>\n            <textarea name=\"body\" cols=\"45\" rows=\"5\" wrap=\"virtual\">");
      out.print(body);
      out.write(
          "</textarea>\n        </td>\n    </tr>\n    <tr>\n        <td colspan=\"2\">\n            <br>\n            <input type=\"submit\" name=\"test\" value=\"");
      if (_jspx_meth_fmt_message_13(_jspx_page_context)) return;
      out.write("\">\n            <input type=\"submit\" name=\"cancel\" value=\"");
      if (_jspx_meth_fmt_message_14(_jspx_page_context)) return;
      out.write(
          "\">\n        </td>\n    </tr>\n</tbody>\n</table>\n\n</form>\n\n    </body>\n</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }