Working on issue #981 - Improved UX: SSL selection should only be shown for LDAPS hostnames. Toggeling the enabled state confuses theuser.
This commit is contained in:
parent
b8a92582a1
commit
f0e2a2e0bb
3 changed files with 23 additions and 13 deletions
|
@ -152,7 +152,7 @@ class ConnectionWizard extends App.WizardModal
|
|||
'click .js-userMappingForm .js-add': 'addUserMapping'
|
||||
'click .js-groupRoleForm .js-add': 'addGroupRoleMapping'
|
||||
'click .js-goToSlide': 'goToSlide'
|
||||
'input .js-hostUrl': 'checkSslVerifyDisabled'
|
||||
'input .js-hostUrl': 'sslVerifyChange'
|
||||
|
||||
elements:
|
||||
'.modal-body': 'body'
|
||||
|
@ -205,13 +205,27 @@ class ConnectionWizard extends App.WizardModal
|
|||
|
||||
showHost: =>
|
||||
@$('.js-discover input[name="host_url"]').val(@wizardConfig.host_url)
|
||||
@showSslVerify()
|
||||
@checkSslVerifyVisibility(@wizardConfig.host_url)
|
||||
|
||||
sslVerifyChange: (e) =>
|
||||
@checkSslVerifyVisibility($(e.currentTarget).val())
|
||||
|
||||
checkSslVerifyVisibility: (host_url) =>
|
||||
el = @$('.js-discover .js-sslVerify')
|
||||
exists = el.length
|
||||
|
||||
showSslVerify: =>
|
||||
disabled = true
|
||||
if @wizardConfig.host_url && @wizardConfig.host_url.startsWith('ldaps')
|
||||
if host_url && host_url.startsWith('ldaps')
|
||||
disabled = false
|
||||
|
||||
if exists && disabled
|
||||
el.parent().remove()
|
||||
else if !exists && !disabled
|
||||
@$('.js-discover tbody tr').last().after(@buildRowSslVerify())
|
||||
|
||||
buildRowSslVerify: =>
|
||||
el = $(App.view('integration/ldap_ssl_verify_row')())
|
||||
|
||||
ssl_verify = true
|
||||
if typeof @wizardConfig.ssl_verify != 'undefined'
|
||||
ssl_verify = @wizardConfig.ssl_verify
|
||||
|
@ -221,15 +235,11 @@ class ConnectionWizard extends App.WizardModal
|
|||
null: false
|
||||
options: { true: 'yes', false: 'no' }
|
||||
default: ssl_verify
|
||||
disabled: disabled
|
||||
translate: true
|
||||
class: 'form-control form-control--small'
|
||||
)
|
||||
@$('.js-discover .js-sslVerify').html sslVerifyElement
|
||||
|
||||
checkSslVerifyDisabled: (e) =>
|
||||
enabled = $(e.currentTarget).val().startsWith('ldaps')
|
||||
@$('.js-discover .js-sslVerify select[name="ssl_verify"]').prop('disabled', !enabled)
|
||||
el.find('.js-sslVerify').html sslVerifyElement
|
||||
el
|
||||
|
||||
discover: (e) =>
|
||||
e.preventDefault()
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<tr>
|
||||
<td class="settings-list-row-control"><%- @T('SSL verification') %>
|
||||
<td class="settings-list-control-cell js-sslVerify">
|
|
@ -20,9 +20,6 @@
|
|||
<tr>
|
||||
<td class="settings-list-row-control"><%- @T('Host') %>
|
||||
<td class="settings-list-control-cell"><input type="text" name="host_url" class="form-control form-control--small js-hostUrl" value="" placeholder="ldaps://ldap.example.com" autocomplete="new-password">
|
||||
<tr>
|
||||
<td class="settings-list-row-control"><%- @T('SSL verification') %>
|
||||
<td class="settings-list-control-cell js-sslVerify">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue