This commit is contained in:
nmemmert
2026-06-03 16:14:49 -04:00
parent e11858c2f3
commit 07519b4f48
+3 -2
View File
@@ -195,13 +195,14 @@ export function register(app) {
return return
} }
const user = state.studyUsers.find(u => u.id === userId) const user = state.studyUsers.find(u => u.id === userId)
if (!user || !user.totpSecret || !user.totpVerified) { const twoFaMethodCheck = user?.twoFaMethod ?? (user?.totpSecret && user?.totpVerified ? 'app' : null)
if (!user || !twoFaMethodCheck) {
res.status(400).json({ message: '2FA is not configured for this account.' }) res.status(400).json({ message: '2FA is not configured for this account.' })
return return
} }
const codeStr = typeof code === 'string' ? code.replace(/\s/g, '') : '' const codeStr = typeof code === 'string' ? code.replace(/\s/g, '') : ''
const twoFaMethod = user.twoFaMethod ?? (user.totpSecret && user.totpVerified ? 'app' : null) const twoFaMethod = twoFaMethodCheck
function completeLogin(extra = {}) { function completeLogin(extra = {}) {
user.lastLoginAt = new Date().toISOString() user.lastLoginAt = new Date().toISOString()