Password aging fix (#10287)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-12-10 19:03:45 +05:00
committed by GitHub
parent 669f05a094
commit a4055d8a0e
3 changed files with 17 additions and 9 deletions
@@ -200,7 +200,7 @@
}
async function changePasswordAgingRules (val: number | undefined): Promise<void> {
passwordAgingRule = Math.max(val ?? 0, 0)
passwordAgingRule = Math.max(val ?? 1, 1)
await accountClient.updatePasswordAgingRule(passwordAgingRule)
}
@@ -346,7 +346,7 @@
<div class="w-32">
<EditBox
format={'number'}
minValue={0}
minValue={1}
maxDigitsAfterPoint={0}
bind:value={passwordAgingRule}
disabled={!passwordAgingRule}
+10 -6
View File
@@ -221,7 +221,9 @@ export async function login (
const isConfirmed = emailSocialId.verifiedOn != null
const extraToken: Record<string, string> = isAdminEmail(normalizedEmail) ? { admin: 'true' } : {}
const extraToken: Record<string, string> = isAdminEmail(normalizedEmail)
? { admin: 'true', authMethod: 'password' }
: { authMethod: 'password' }
ctx.info('Login succeeded', { email, normalizedEmail, isConfirmed, emailSocialId, ...extraToken })
return {
@@ -505,7 +507,9 @@ export async function validateOtp (
await resetFailedLoginAttempts(db, emailSocialId.personUuid as AccountUuid)
const extraToken: Record<string, string> = isAdminEmail(normalizedEmail) ? { admin: 'true' } : {}
const extraToken: Record<string, string> = isAdminEmail(normalizedEmail)
? { admin: 'true', authMethod: 'otp' }
: { authMethod: 'otp' }
return {
account: emailSocialId.personUuid as AccountUuid,
@@ -536,7 +540,7 @@ export async function createWorkspace (
throw new PlatformError(new Status(Severity.ERROR, platform.status.BadRequest, {}))
}
const { account } = decodeTokenVerbose(ctx, token)
const { account, extra } = decodeTokenVerbose(ctx, token)
checkRateLimit(account, workspaceName)
@@ -578,7 +582,7 @@ export async function createWorkspace (
account,
socialId: socialId._id,
name: getPersonName(person),
token: generateToken(account, workspaceUuid),
token: generateToken(account, workspaceUuid, extra),
endpoint: getEndpoint(workspaceUuid, region, EndpointKind.External),
workspace: workspaceUuid,
workspaceUrl,
@@ -1393,7 +1397,7 @@ export async function leaveWorkspace (
throw new PlatformError(new Status(Severity.ERROR, platform.status.BadRequest, {}))
}
const { account, workspace } = decodeTokenVerbose(ctx, token)
const { account, workspace, extra } = decodeTokenVerbose(ctx, token)
ctx.info('Removing account from workspace', { account, workspace })
if (account == null || workspace == null) {
@@ -1426,7 +1430,7 @@ export async function leaveWorkspace (
return {
account,
name: getPersonName(person),
token: generateToken(account, undefined)
token: generateToken(account, undefined, extra)
}
}
+5 -1
View File
@@ -939,7 +939,11 @@ export async function checkPasswordAging (
branding: Branding | null,
token: string
): Promise<boolean> {
const { account, workspace } = decodeTokenVerbose(ctx, token)
const { account, workspace, extra } = decodeTokenVerbose(ctx, token)
if (extra?.authMethod !== 'password') {
return true
}
if (workspace === null) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.WorkspaceNotFound, { workspaceUuid: workspace }))