From fac2f7afe672ec670972a56fd0730597dcf6865d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Apr 2020 10:22:59 +0200 Subject: [PATCH] Fix ldap weight setting --- peertube-plugin-auth-ldap/main.js | 8 ++++++-- peertube-plugin-auth-ldap/package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/peertube-plugin-auth-ldap/main.js b/peertube-plugin-auth-ldap/main.js index 1360546..4f554d6 100644 --- a/peertube-plugin-auth-ldap/main.js +++ b/peertube-plugin-auth-ldap/main.js @@ -84,10 +84,10 @@ async function register ({ login: options => login(peertubeHelpers, settingsManager, options) }) - store.weight = await settingsManager.getSetting('weight') + setWeight(await settingsManager.getSetting('weight')) settingsManager.onSettingsChange(settings => { - if (settigns && typeof settings.weight === 'number') store.weight = weight + if (settings && settings.weight) setWeight(settings.weight) }) } @@ -102,6 +102,10 @@ module.exports = { // ############################################################################ +function setWeight (weight) { + store.weight = parseInt(weight + '', 10) +} + async function login (peertubeHelpers, settingsManager, options) { const logger = peertubeHelpers.logger diff --git a/peertube-plugin-auth-ldap/package.json b/peertube-plugin-auth-ldap/package.json index 7be3567..185da2d 100644 --- a/peertube-plugin-auth-ldap/package.json +++ b/peertube-plugin-auth-ldap/package.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-auth-ldap", - "version": "0.0.1", + "version": "0.0.3", "description": "Add LDAP support to login form in PeerTube.", "engine": { "peertube": ">=2.2.0"