Skip to content

Commit

Permalink
JENKINS-61812 Fix read only password (#4622)
Browse files Browse the repository at this point in the history
* JENKINS-61812 Fix read only password

* Don't call getPasswordValue until later
  • Loading branch information
timja committed Apr 21, 2020
1 parent 57e1d26 commit 5de91d0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/resources/lib/form/password.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,22 @@ THE SOFTWARE.
If any other value is specified then requests will use GET.
</st:attribute>
</st:documentation>
<f:prepareDatabinding/>
<j:set var="resolvedValue" value="${attrs.value ?: instance[attrs.field]}" />

<j:choose>
<j:when test="${readOnlyMode}">
<j:choose>
<j:when test="${value}"><span class="jenkins-readonly">****</span></j:when>
<j:when test="${!empty(resolvedValue)}"><span class="jenkins-readonly">****</span></j:when>
<j:otherwise>
<span class="jenkins-not-applicable">N/A</span>
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<f:prepareDatabinding/>
<j:choose>
<j:when test="${h.useHidingPasswordFields()}">
<j:set var="value" value="${h.getPasswordValue(attrs.value ?: instance[attrs.field])}"/>
<j:set var="value" value="${h.getPasswordValue(resolvedValue)}"/>
<j:choose>
<j:when test="${ value != null }">
<st:adjunct includes="lib.form.password.password"/>
Expand Down Expand Up @@ -134,7 +136,7 @@ THE SOFTWARE.
<m:input xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary"
class="setting-input ${attrs.checkUrl!=null?'validated ':''}${attrs.clazz}"
name="${attrs.name ?: '_.'+attrs.field}"
value="${h.getPasswordValue(attrs.value ?: instance[attrs.field])}"
value="${h.getPasswordValue(resolvedValue)}"
type="password"
checkMethod="post"
ATTRIBUTES="${attrs}" EXCEPT="field clazz value"/>
Expand Down

0 comments on commit 5de91d0

Please sign in to comment.