diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 603de3483a..142a70d4c0 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -92,6 +92,7 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { ? 0 : config.logoMargin }) + store.commit('authFlow/setInitialStrategy', config['loginMethod@']) copyInstanceOption('redirectRootNoLogin') copyInstanceOption('redirectRootLogin') @@ -100,7 +101,6 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { copyInstanceOption('formattingOptionsEnabled') copyInstanceOption('hideMutedPosts') copyInstanceOption('collapseMessageWithSubject') - copyInstanceOption('loginMethod') copyInstanceOption('scopeCopy') copyInstanceOption('subjectLineBehavior') copyInstanceOption('postContentType') diff --git a/src/modules/auth_flow.js b/src/modules/auth_flow.js index 01ec17e24a..40d27b99f5 100644 --- a/src/modules/auth_flow.js +++ b/src/modules/auth_flow.js @@ -5,16 +5,11 @@ const TOKEN_STRATEGY = 'token' const TOTP_STRATEGY = 'totp' const RECOVERY_STRATEGY = 'recovery' - -const fetchStrategy = (state, rootState) => { - return state.strategy || rootState.instance.loginMethod || PASSWORD_STRATEGY -} - // initial state const state = { app: null, settings: {}, - strategy: null + strategy: PASSWORD_STRATEGY } // getters @@ -26,21 +21,24 @@ const getters = { return state.settings }, requiredPassword: (state, getters, rootState) => { - return fetchStrategy(state, rootState) === PASSWORD_STRATEGY + return state.strategy === PASSWORD_STRATEGY }, requiredToken: (state, getters, rootState) => { - return fetchStrategy(state, rootState) === TOKEN_STRATEGY + return state.strategy === TOKEN_STRATEGY }, requiredTOTP: (state, getters, rootState) => { - return fetchStrategy(state, rootState) === TOTP_STRATEGY + return state.strategy === TOTP_STRATEGY }, requiredRecovery: (state, getters, rootState) => { - return fetchStrategy(state, rootState) === RECOVERY_STRATEGY + return state.strategy === RECOVERY_STRATEGY } } // mutations const mutations = { + setInitialStrategy (state, strategy) { + if (strategy) { state.strategy = strategy } + }, requirePassword (state) { state.strategy = PASSWORD_STRATEGY }, @@ -50,7 +48,7 @@ const mutations = { requireMFA (state, {app, settings}) { state.settings = settings state.app = app - state.strategy = TOTP_STRATEGY + state.strategy = TOTP_STRATEGY // default strategy of MFA }, requireRecovery (state) { state.strategy = RECOVERY_STRATEGY @@ -59,7 +57,7 @@ const mutations = { state.strategy = TOTP_STRATEGY }, reset (state) { - state.strategy = null + state.strategy = PASSWORD_STRATEGY state.settings = {} state.app = null } diff --git a/src/modules/instance.js b/src/modules/instance.js index d4185f6aa9..fc4578ed7c 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -27,7 +27,6 @@ const defaultState = { scopeCopy: true, subjectLineBehavior: 'email', postContentType: 'text/plain', - loginMethod: 'password', nsfwCensorImage: undefined, vapidPublicKey: undefined, noAttachmentLinks: false,