Skip to content

Commit

Permalink
[FIXED JENKINS-11172] Don't throw exception on /signup when not possible
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Dec 21, 2014
1 parent aa7f0a9 commit 277b177
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -3560,7 +3560,11 @@ public void doEval(StaplerRequest req, StaplerResponse rsp) throws IOException,
* Sign up for the user account.
*/
public void doSignup( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
req.getView(getSecurityRealm(), "signup.jelly").forward(req, rsp);
if (getSecurityRealm().allowsSignup()) {
req.getView(getSecurityRealm(), "signup.jelly").forward(req, rsp);

This comment has been minimized.

This comment has been minimized.

Copy link
@daniel-beck

daniel-beck Jan 22, 2015

Author Member

Unrelated to this PR, as I just reused what was there.

This comment has been minimized.

Copy link
@oleg-nenashev

oleg-nenashev Jan 22, 2015

Member

Yes. Anyway, there's a very low risk of the issue.
No need to fix ASAP

return;
}
req.getView(SecurityRealm.class, "signup.jelly").forward(req, rsp);
}

/**
Expand Down
33 changes: 33 additions & 0 deletions core/src/main/resources/hudson/security/SecurityRealm/signup.jelly
@@ -0,0 +1,33 @@
<!--
The MIT License
Copyright (c) 2014 Daniel Beck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
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" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<st:include page="sidepanel.jelly" from="${app}" it="${app}" />
<l:layout title="${%Signup not supported}">
<l:main-panel>
<h1>${%Sign up}</h1>
${%This is not supported in the current configuration.}
</l:main-panel>
</l:layout>
</j:jelly>

0 comments on commit 277b177

Please sign in to comment.