<%@ page contentType="text/html; charset=UTF-8" %> <%-- - Copyright (C) 2005-2008 Jive Software, 2017-2022 Ignite Realtime Foundation. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> <%@ page import="org.jivesoftware.util.*, java.util.*" errorPage="error.jsp" %> <%@ taglib uri="admin" prefix="admin" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%-- Define Administration Bean --%> <% webManager.init(request, response, session, application, out ); %> <% // Get paramters boolean doTest = request.getParameter("test") != null; boolean cancel = request.getParameter("cancel") != null; String recipient = ParamUtils.getParameter(request, "recipient"); String message = ParamUtils.getParameter(request, "message"); // Cancel if requested if (cancel) { response.sendRedirect("system-sms.jsp"); return; } // Validate input Map errors = new HashMap<>(); Cookie csrfCookie = CookieUtils.getCookie(request, "csrf"); String csrfParam = ParamUtils.getParameter(request, "csrf"); if (doTest) { if (csrfCookie == null || csrfParam == null || !csrfCookie.getValue().equals(csrfParam)) { doTest = false; errors.put("csrf", "CSRF Failure!"); } } csrfParam = StringUtils.randomString(15); CookieUtils.setCookie(request, response, "csrf", csrfParam, -1); pageContext.setAttribute("csrf", csrfParam); // See if the service has basic configuration. if ( JiveGlobals.getProperty( "sms.smpp.host" ) == null ) { errors.put( "host", "cannot be missing or empty." ); } if ( JiveGlobals.getProperty( "sms.smpp.systemId" ) == null ) { errors.put( "systemId", "cannot be missing or empty." ); } if (JiveGlobals.getProperty( "sms.smpp.password" ) == null ) { errors.put( "password", "cannot be missing or empty."); } if (doTest) { if (recipient == null || recipient.trim().isEmpty() ) { errors.put("recipient", "Recipient cannot be missing or empty."); } if (message == null || message.trim().isEmpty() ) { errors.put("message", "Message cannot be missing or empty."); } if (errors.isEmpty()) { final SmsService service = SmsService.getInstance(); try { service.sendImmediately( message, recipient ); response.sendRedirect("system-smstest.jsp?sent=true&success=true"); return; } catch ( Exception e ) { errors.put( "sendfailed", StringUtils.escapeHTMLTags(SmsService.getDescriptiveMessage( e ), true) ); } } } pageContext.setAttribute( "errors", errors ); pageContext.setAttribute( "recipient", recipient ); pageContext.setAttribute( "message", message ); %> <fmt:message key="system.smstest.title"/> "/>

 
 

" ${ not empty errors['host'] or not empty errors['systemId'] or not empty errors['password'] ? 'disabled' : ''}> ">