allow OTP login for all users when plugin is active
Treat requested OTP auth as globally available whenever an OTP auth method plugin is enabled, independent of per-user enabledAuthMethods. This keeps OTP usable for all users without requiring per-user method toggles.
This commit is contained in:
@@ -2047,6 +2047,12 @@ function preferredAuthMethodId(methods) {
|
|||||||
|
|
||||||
function resolveAuthMethodForUser(user, requestedMethodId) {
|
function resolveAuthMethodForUser(user, requestedMethodId) {
|
||||||
const all = listPublicAuthMethods();
|
const all = listPublicAuthMethods();
|
||||||
|
if (requestedMethodId) {
|
||||||
|
const requestedPublic = all.find((entry) => entry.id === requestedMethodId) || null;
|
||||||
|
if (requestedPublic && requestedPublic.type === "otp") {
|
||||||
|
return requestedPublic;
|
||||||
|
}
|
||||||
|
}
|
||||||
const enabledSet = new Set(Array.isArray(user.enabledAuthMethods) ? user.enabledAuthMethods : []);
|
const enabledSet = new Set(Array.isArray(user.enabledAuthMethods) ? user.enabledAuthMethods : []);
|
||||||
const allowed = all.filter((entry) => enabledSet.has(entry.id));
|
const allowed = all.filter((entry) => enabledSet.has(entry.id));
|
||||||
if (allowed.length === 0) {
|
if (allowed.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user