Fix for auth logout test case.
This commit is contained in:
parent
d6b0b7610a
commit
8fb5168d56
|
@ -225,7 +225,12 @@ export async function platformLogout(opts: PlatformLogoutOpts) {
|
||||||
|
|
||||||
const sessionIds = sessions.map(({ sessionId }) => sessionId)
|
const sessionIds = sessions.map(({ sessionId }) => sessionId)
|
||||||
await invalidateSessions(userId, { sessionIds, reason: "logout" })
|
await invalidateSessions(userId, { sessionIds, reason: "logout" })
|
||||||
const user = await userCache.getUser(userId)
|
let user: User | undefined
|
||||||
await events.auth.logout(user.email)
|
try {
|
||||||
|
user = await userCache.getUser(userId)
|
||||||
|
} catch {
|
||||||
|
user = undefined
|
||||||
|
}
|
||||||
|
await events.auth.logout(user?.email)
|
||||||
await userCache.invalidateUser(userId)
|
await userCache.invalidateUser(userId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ async function login(source: LoginSource, email: string) {
|
||||||
await publishEvent(Event.AUTH_LOGIN, properties)
|
await publishEvent(Event.AUTH_LOGIN, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function logout(email: string) {
|
async function logout(email?: string) {
|
||||||
const identity = await identification.getCurrentIdentity()
|
const identity = await identification.getCurrentIdentity()
|
||||||
const properties: LogoutEvent = {
|
const properties: LogoutEvent = {
|
||||||
userId: identity.id,
|
userId: identity.id,
|
||||||
|
|
|
@ -15,7 +15,7 @@ export interface LoginEvent extends BaseEvent {
|
||||||
export interface LogoutEvent extends BaseEvent {
|
export interface LogoutEvent extends BaseEvent {
|
||||||
userId: string
|
userId: string
|
||||||
audited: {
|
audited: {
|
||||||
email: string
|
email?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue