chore: Add actor type check + more tests (#10005)

This commit is contained in:
Oli Juhl
2024-11-10 21:38:19 +00:00
committed by GitHub
parent c7b24eb3ec
commit 094971775b
5 changed files with 140 additions and 10 deletions
@@ -43,15 +43,15 @@ export class EmailPassAuthService extends AbstractAuthModuleProvider {
}
async update(
data: { email: string; password: string },
data: { password: string; entity_id: string },
authIdentityService: AuthIdentityProviderService
) {
const { email, password } = data ?? {}
const { password, entity_id } = data ?? {}
if (!email || !isString(email)) {
if (!entity_id) {
return {
success: false,
error: `Cannot update ${this.provider} provider identity without email`,
error: `Cannot update ${this.provider} provider identity without entity_id`,
}
}
@@ -64,7 +64,7 @@ export class EmailPassAuthService extends AbstractAuthModuleProvider {
try {
const passwordHash = await this.hashPassword(password)
authIdentity = await authIdentityService.update(email, {
authIdentity = await authIdentityService.update(entity_id, {
provider_metadata: {
password: passwordHash,
},