提交 a03254b9 编写于 作者: W Wadeck Follonier 提交者: Oleg Nenashev

Admin monitor message: separation between content and display (#3416)

* Better separation between content and display
- also put the version for the RootUrlNotSetMonitor and the HttpResponses new method

* Add blank line
上级 a4a1355f
......@@ -106,7 +106,7 @@ public class HttpResponses extends org.kohsuke.stapler.HttpResponses {
* @param data The data.
* @return {@code this} object.
*
* @since TODO
* @since 2.119
*/
public static HttpResponse errorJSON(@Nonnull String message, @Nonnull Map<?,?> data) {
return new JSONObjectResponse(data).error(message);
......
......@@ -38,7 +38,7 @@ import org.kohsuke.accmod.restrictions.NoExternalUse;
* Potential exceptions are the dev environment, if someone disable the wizard or
* the administrator put an empty string on the configuration page.
*
* @since TODO
* @since 2.119
*/
@Extension
@Symbol("rootUrlNotSet")
......@@ -52,15 +52,13 @@ public class RootUrlNotSetMonitor extends AdministrativeMonitor {
@Override
public boolean isActivated() {
JenkinsLocationConfiguration loc = JenkinsLocationConfiguration.get();
return loc != null && (
loc.getUrl() == null || !UrlHelper.isValidRootUrl(loc.getUrl())
);
return loc.getUrl() == null || !UrlHelper.isValidRootUrl(loc.getUrl());
}
// used by jelly to determined if it's a null url or invalid one
@Restricted(NoExternalUse.class)
public boolean isUrlNull(){
JenkinsLocationConfiguration loc = JenkinsLocationConfiguration.get();
return loc != null && loc.getUrl() == null;
return loc.getUrl() == null;
}
}
......@@ -46,6 +46,6 @@ public class CSRFAdministrativeMonitor extends AdministrativeMonitor {
@Override
public boolean isActivated() {
return Jenkins.getInstance().getCrumbIssuer() == null;
return Jenkins.get().getCrumbIssuer() == null;
}
}
......@@ -22,15 +22,24 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<div class="alert alert-warning">
<form method="post" action="${rootURL}/${it.url}/disable">
<f:submit value="${%Dismiss}"/>
</form>
<j:set var="actionAnchor">
<a href="${rootURL}/configure">${%actionUrlContent}</a>
</j:set>
<j:choose>
<j:when test="${it.isUrlNull()}">
${%urlIsNull(rootURL)}
${%urlIsNull}
</j:when>
<j:otherwise>
${%urlIsInvalid(rootURL)}
${%urlIsInvalid}
</j:otherwise>
</j:choose>
<p />
<j:out value="${%actionToTake(actionAnchor)}"/>
</div>
</j:jelly>
urlIsNull=Jenkins root URL is empty but is required for the proper operation of many Jenkins features like email notifications, \
PR status update, and environment variables such as <code>BUILD_URL</code>.<br />\
Please provide an accurate value in <a href="{0}/configure">Jenkins configuration</a>.
PR status update, and environment variables such as <code>BUILD_URL</code>.
urlIsInvalid=Jenkins root URL seems to be invalid. It is required for the proper operation of many Jenkins features like email notifications, \
PR status update, and environment variables such as <code>BUILD_URL</code>.<br />\
Please provide an accurate value in <a href="{0}/configure">Jenkins configuration</a>.
PR status update, and environment variables such as <code>BUILD_URL</code>.
actionToTake=Please provide an accurate value in {0}.
actionUrlContent=Jenkins configuration
......@@ -22,8 +22,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<div class="alert alert-warning">
${%warningMessage(rootURL)}
<form method="post" action="${rootURL}/${it.url}/disable">
<f:submit value="${%Dismiss}"/>
</form>
<j:set var="referenceAnchor">
<a href="https://jenkins.io/redirect/csrf-protection" target="_blank">${%referenceUrlContent}</a>
</j:set>
<j:set var="actionAnchor">
<a href="${rootURL}/configureSecurity">${%actionUrlContent}</a>
</j:set>
<j:out value="${%warningMessage(referenceAnchor)}"/>
<p />
<j:out value="${%actionMessage(actionAnchor)}"/>
</div>
</j:jelly>
warningMessage=You have not configured the CSRF issuer. This could be a security issue. \
For more information, please refer to <a href="https://jenkins.io/redirect/csrf-protection" target="_blank">this page</a>. \
<br /> \
You can change the current configuration using the Security section <a href="{0}/configureSecurity">CSRF Protection</a>.
For more information, please refer to {0}.
actionMessage=You can change the current configuration using the Security section {0}.
referenceUrlContent=this page
actionUrlContent=CSRF Protection
\ No newline at end of file
......@@ -22,7 +22,7 @@
warningMessage=L''emittente CSRF non è stata configurata. Ciò potrebbe costituire \
un problema di sicurezza. \
Per ulteriori informazioni, fare riferimento a <a href="https://jenkins.io/redirect/csrf-protection" target="_blank">questa pagina</a>. \
<br /> \
È possibile modificare la configurazione corrente nella sezione \
<a href="{0}/configureSecurity">Protezione CSRF</a> della categoria Sicurezza.
Per ulteriori informazioni, fare riferimento a {0}.
actionMessage=È possibile modificare la configurazione corrente nella sezione {0} della categoria Sicurezza.
referenceUrlContent=questa pagina
actionUrlContent=Protezione CSRF
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册