This commit is contained in:
Matthew Bell 2024-10-15 16:37:27 +01:00 committed by GitHub
commit b115835627
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 227 additions and 10 deletions

View file

@ -634,7 +634,30 @@ class MiscController {
for (const key in currentAuthenticationSettings) {
if (settingsUpdate[key] === undefined) continue
if (key === 'authActiveAuthMethods') {
if (key === 'authForwardAuthPattern') {
const updatedValue = settingsUpdate[key]
if (updatedValue === '') updatedValue = null
let currentValue = currentAuthenticationSettings[key]
if (currentValue === '') currentValue = null
if (updatedValue !== currentValue) {
Logger.debug(`[MiscController] Updating auth settings key "${key}" from "${currentValue}" to "${updatedValue}"`)
Database.serverSettings[key] = updatedValue
hasUpdates = true
}
} else if (key === 'authForwardAuthEnabled') {
if (typeof settingsUpdate[key] !== 'boolean') {
Logger.warn(`[MiscController] Invalid value for ${key}. Expected boolean`)
continue
}
let updatedValue = settingsUpdate[key]
let currentValue = currentAuthenticationSettings[key]
if (updatedValue !== currentValue) {
Logger.debug(`[MiscController] Updating auth settings key "${key}" from "${currentValue}" to "${updatedValue}"`)
Database.serverSettings[key] = updatedValue
hasUpdates = true
}
} else if (key === 'authActiveAuthMethods') {
let updatedAuthMethods = settingsUpdate[key]?.filter?.((authMeth) => Database.serverSettings.supportedAuthMethods.includes(authMeth))
if (Array.isArray(updatedAuthMethods) && updatedAuthMethods.length) {
updatedAuthMethods.sort()