Add weight support in LDAP plugin
This commit is contained in:
parent
fc9be54433
commit
9b66758c3d
@ -1,11 +1,23 @@
|
||||
const LdapAuth = require('ldapauth-fork')
|
||||
|
||||
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 () {
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user