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:
Thorsten Eckel 2017-05-10 09:43:16 +02:00
parent b8a92582a1
commit f0e2a2e0bb
3 changed files with 23 additions and 13 deletions

View file

@ -152,7 +152,7 @@ class ConnectionWizard extends App.WizardModal
'click .js-userMappingForm .js-add': 'addUserMapping' 'click .js-userMappingForm .js-add': 'addUserMapping'
'click .js-groupRoleForm .js-add': 'addGroupRoleMapping' 'click .js-groupRoleForm .js-add': 'addGroupRoleMapping'
'click .js-goToSlide': 'goToSlide' 'click .js-goToSlide': 'goToSlide'
'input .js-hostUrl': 'checkSslVerifyDisabled' 'input .js-hostUrl': 'sslVerifyChange'
elements: elements:
'.modal-body': 'body' '.modal-body': 'body'
@ -205,13 +205,27 @@ class ConnectionWizard extends App.WizardModal
showHost: => showHost: =>
@$('.js-discover input[name="host_url"]').val(@wizardConfig.host_url) @$('.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 disabled = true
if @wizardConfig.host_url && @wizardConfig.host_url.startsWith('ldaps') if host_url && host_url.startsWith('ldaps')
disabled = false 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 ssl_verify = true
if typeof @wizardConfig.ssl_verify != 'undefined' if typeof @wizardConfig.ssl_verify != 'undefined'
ssl_verify = @wizardConfig.ssl_verify ssl_verify = @wizardConfig.ssl_verify
@ -221,15 +235,11 @@ class ConnectionWizard extends App.WizardModal
null: false null: false
options: { true: 'yes', false: 'no' } options: { true: 'yes', false: 'no' }
default: ssl_verify default: ssl_verify
disabled: disabled
translate: true translate: true
class: 'form-control form-control--small' class: 'form-control form-control--small'
) )
@$('.js-discover .js-sslVerify').html sslVerifyElement el.find('.js-sslVerify').html sslVerifyElement
el
checkSslVerifyDisabled: (e) =>
enabled = $(e.currentTarget).val().startsWith('ldaps')
@$('.js-discover .js-sslVerify select[name="ssl_verify"]').prop('disabled', !enabled)
discover: (e) => discover: (e) =>
e.preventDefault() e.preventDefault()

View file

@ -0,0 +1,3 @@
<tr>
<td class="settings-list-row-control"><%- @T('SSL verification') %>
<td class="settings-list-control-cell js-sslVerify">

View file

@ -20,9 +20,6 @@
<tr> <tr>
<td class="settings-list-row-control"><%- @T('Host') %> <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"> <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> </tbody>
</table> </table>
</div> </div>