@medusajs/auth-emailpass 0.0.2-snapshot-20240531102054 → 0.0.2-snapshot-20240607093839

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,6 @@ class EmailPassAuthService extends utils_1.AbstractAuthModuleProvider {
30
30
  try {
31
31
  authIdentity = await authIdentityService.retrieve({
32
32
  entity_id: email,
33
- provider: this.provider,
34
33
  });
35
34
  }
36
35
  catch (error) {
@@ -39,13 +38,13 @@ class EmailPassAuthService extends utils_1.AbstractAuthModuleProvider {
39
38
  const passwordHash = await scrypt_kdf_1.default.kdf(password, config);
40
39
  const createdAuthIdentity = await authIdentityService.create({
41
40
  entity_id: email,
42
- provider: this.provider,
43
41
  provider_metadata: {
44
42
  password: passwordHash.toString("base64"),
45
43
  },
46
44
  });
47
45
  const copy = JSON.parse(JSON.stringify(createdAuthIdentity));
48
- delete copy.provider_metadata?.password;
46
+ const providerIdentity = copy.provider_identities?.find((pi) => pi.provider === this.provider);
47
+ delete providerIdentity.provider_metadata?.password;
49
48
  return {
50
49
  success: true,
51
50
  authIdentity: copy,
@@ -53,13 +52,15 @@ class EmailPassAuthService extends utils_1.AbstractAuthModuleProvider {
53
52
  }
54
53
  return { success: false, error: error.message };
55
54
  }
56
- const passwordHash = authIdentity.provider_metadata?.password;
55
+ const providerIdentity = authIdentity.provider_identities?.find((pi) => pi.provider === this.provider);
56
+ const passwordHash = providerIdentity.provider_metadata?.password;
57
57
  if ((0, utils_1.isString)(passwordHash)) {
58
58
  const buf = Buffer.from(passwordHash, "base64");
59
59
  const success = await scrypt_kdf_1.default.verify(buf, password);
60
60
  if (success) {
61
61
  const copy = JSON.parse(JSON.stringify(authIdentity));
62
- delete copy.provider_metadata.password;
62
+ const providerIdentity = copy.provider_identities?.find((pi) => pi.provider === this.provider);
63
+ delete providerIdentity.provider_metadata?.password;
63
64
  return {
64
65
  success,
65
66
  authIdentity: copy,
@@ -73,4 +74,4 @@ class EmailPassAuthService extends utils_1.AbstractAuthModuleProvider {
73
74
  }
74
75
  }
75
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BQ0wsT0FBTyxFQUFFLEtBQUs7WUFDZCxLQUFLLEVBQUUsMkJBQTJCO1NBQ25DLENBQUE7SUFDSCxDQUFDO0NBQ0Y7QUFoR0Qsb0RBZ0dDIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/auth-emailpass",
3
- "version": "0.0.2-snapshot-20240531102054",
3
+ "version": "0.0.2-snapshot-20240607093839",
4
4
  "description": "Email and password credential authentication provider for Medusa",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "typescript": "^4.9.5"
31
31
  },
32
32
  "dependencies": {
33
- "@medusajs/utils": "1.12.0-snapshot-20240531102054",
33
+ "@medusajs/utils": "1.12.0-snapshot-20240607093839",
34
34
  "scrypt-kdf": "^2.0.1"
35
35
  },
36
36
  "keywords": [