Verified Commit 9b66758c authored by Chocobozzz's avatar Chocobozzz
Browse files

Add weight support in LDAP plugin

parent fc9be544
const LdapAuth = require('ldapauth-fork')
async function register ({
registerIdAndPassAuth,
registerSetting,
settingsManager,
const store = {
weight: 100
}
async function register ({
registerIdAndPassAuth,
registerSetting,
settingsManager,
peertubeHelpers
}) {
registerSetting({
name: 'weight',
label: 'Auth weight',
type: 'input',
private: true,
default: 100
})
registerSetting({
name: 'url',
label: 'URL',
......@@ -68,9 +80,15 @@ async function register ({
registerIdAndPassAuth({
authName: 'ldap',
getWeight: () => 100,
getWeight: () => store.weight,
login: options => login(peertubeHelpers, settingsManager, options)
})
store.weight = await settingsManager.getSetting('weight')
settingsManager.onSettingsChange(settings => {
if (settigns && typeof settings.weight === 'number') store.weight = weight
})
}
async function unregister () {
......@@ -154,4 +172,4 @@ async function login (peertubeHelpers, settingsManager, options) {
})
})
})
}
\ No newline at end of file
}
......@@ -89,7 +89,7 @@ async function register ({
{
const result = registerExternalAuth({
authName: 'fake-auth',
authDisplayName: 'fake auth',
authDisplayName: () => 'fake auth',
onAuthRequest: (req, res) => {
result.userAuthenticated({
req,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment