Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl committed Sep 5, 2024
1 parent 191d9fc commit 924a071
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export class EmailPassAuthService extends AbstractAuthModuleProvider {
}

async update(
providerMetadata: Record<string, unknown>,
data: { email: string; password: string },
authIdentityService: AuthIdentityProviderService
) {
const { email, password } = providerMetadata ?? {}
const { email, password } = data ?? {}

if (!email || !isString(email)) {
return {
Expand All @@ -54,8 +54,6 @@ export class EmailPassAuthService extends AbstractAuthModuleProvider {
}
}

// The only update allowed is the password
// Question: Should we throw if not provided?
if (!password || !isString(password)) {
return { success: true }
}
Expand All @@ -74,15 +72,9 @@ export class EmailPassAuthService extends AbstractAuthModuleProvider {
return { success: false, error: error.message }
}

const copy = JSON.parse(JSON.stringify(authIdentity))
const providerIdentity = copy.provider_identities?.find(
(pi) => pi.provider === this.provider
)!
delete providerIdentity.provider_metadata?.password

return {
success: true,
authIdentity: copy,
authIdentity,
}
}

Expand Down

0 comments on commit 924a071

Please sign in to comment.