diff options
Diffstat (limited to 'client/components/settings')
-rw-r--r-- | client/components/settings/settingBody.jade | 19 | ||||
-rw-r--r-- | client/components/settings/settingBody.js | 40 |
2 files changed, 54 insertions, 5 deletions
diff --git a/client/components/settings/settingBody.jade b/client/components/settings/settingBody.jade index 153649fc..220dbb50 100644 --- a/client/components/settings/settingBody.jade +++ b/client/components/settings/settingBody.jade @@ -142,6 +142,16 @@ template(name='layoutSettings') input.form-control#hide-logo(type="radio" name="hideLogo" value="false" checked="{{#unless currentSetting.hideLogo}}checked{{/unless}}") span {{_ 'no'}} li.layout-form + .title {{_ 'display-authentication-method'}} + .form-group.flex + input.form-control#display-authentication-method(type="radio" name="displayAuthenticationMethod" value="true" checked="{{#if currentSetting.displayAuthenticationMethod}}checked{{/if}}") + span {{_ 'yes'}} + input.form-control#display-authentication-method(type="radio" name="displayAuthenticationMethod" value="false" checked="{{#unless currentSetting.displayAuthenticationMethod}}checked{{/unless}}") + span {{_ 'no'}} + li.layout-form + .title {{_ 'default-authentication-method'}} + +selectAuthenticationMethod(authenticationMethod=currentSetting.defaultAuthenticationMethod) + li.layout-form .title {{_ 'custom-product-name'}} .form-group input.form-control#product-name(type="text", placeholder="Wekan" value="{{currentSetting.productName}}") @@ -153,3 +163,12 @@ template(name='layoutSettings') textarea#customHTMLbeforeBodyEnd.form-control= currentSetting.customHTMLbeforeBodyEnd li button.js-save-layout.primary {{_ 'save'}} + + +template(name='selectAuthenticationMethod') + select#defaultAuthenticationMethod + each authentications + if isSelected value + option(value="{{value}}" selected) {{_ value}} + else + option(value="{{value}}") {{_ value}}
\ No newline at end of file diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js index 4f07c84c..2f58d551 100644 --- a/client/components/settings/settingBody.js +++ b/client/components/settings/settingBody.js @@ -62,6 +62,9 @@ BlazeComponent.extendComponent({ toggleHideLogo() { $('#hide-logo').toggleClass('is-checked'); }, + toggleDisplayAuthenticationMethod() { + $('#display-authentication-method').toggleClass('is-checked'); + }, switchMenu(event) { const target = $(event.target); if (!target.hasClass('active')) { @@ -140,17 +143,20 @@ BlazeComponent.extendComponent({ const productName = $('#product-name').val().trim(); const hideLogoChange = ($('input[name=hideLogo]:checked').val() === 'true'); + const displayAuthenticationMethod = ($('input[name=displayAuthenticationMethod]:checked').val() === 'true'); + const defaultAuthenticationMethod = $('#defaultAuthenticationMethod').val(); const customHTMLafterBodyStart = $('#customHTMLafterBodyStart').val().trim(); const customHTMLbeforeBodyEnd = $('#customHTMLbeforeBodyEnd').val().trim(); try { - Settings.update(Settings.findOne()._id, { $set: { productName, hideLogo: hideLogoChange, customHTMLafterBodyStart, customHTMLbeforeBodyEnd, + displayAuthenticationMethod, + defaultAuthenticationMethod, }, }); } catch (e) { @@ -165,17 +171,14 @@ BlazeComponent.extendComponent({ sendSMTPTestEmail() { Meteor.call('sendSMTPTestEmail', (err, ret) => { - if (!err && ret) { /* eslint-disable no-console */ + if (!err && ret) { const message = `${TAPi18n.__(ret.message)}: ${ret.email}`; - console.log(message); alert(message); } else { const reason = err.reason || ''; const message = `${TAPi18n.__(err.error)}\n${reason}`; - console.log(message, err); alert(message); } - /* eslint-enable no-console */ }); }, @@ -190,6 +193,7 @@ BlazeComponent.extendComponent({ 'click button.js-send-smtp-test-email': this.sendSMTPTestEmail, 'click a.js-toggle-hide-logo': this.toggleHideLogo, 'click button.js-save-layout': this.saveLayout, + 'click a.js-toggle-display-authentication-method': this.toggleDisplayAuthenticationMethod, }]; }, }).register('setting'); @@ -262,3 +266,29 @@ BlazeComponent.extendComponent({ }]; }, }).register('announcementSettings'); + + +Template.selectAuthenticationMethod.onCreated(function() { + this.authenticationMethods = new ReactiveVar([]); + + Meteor.call('getAuthenticationsEnabled', (_, result) => { + if (result) { + // TODO : add a management of different languages + // (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')}) + this.authenticationMethods.set([ + {value: 'password'}, + // Gets only the authentication methods availables + ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})), + ]); + } + }); +}); + +Template.selectAuthenticationMethod.helpers({ + authentications() { + return Template.instance().authenticationMethods.get(); + }, + isSelected(match) { + return Template.instance().data.authenticationMethod === match; + }, +}); |