@live-change/password-authentication-service 0.8.118 → 0.8.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +3 -3
  2. package/reset.js +2 -3
  3. package/signIn.js +3 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/password-authentication-service",
3
- "version": "0.8.118",
3
+ "version": "0.8.119",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.8.118",
25
+ "@live-change/framework": "^0.8.119",
26
26
  "nodemailer": "^6.7.2"
27
27
  },
28
- "gitHead": "cfccde9b1d340cbb23df96a2f0fba72da0a6e3ab"
28
+ "gitHead": "1f0bb577d5bfe8b8d355775d7adbd73c789cd1d5"
29
29
  }
package/reset.js CHANGED
@@ -80,9 +80,8 @@ for(const contactType of config.contactTypes) {
80
80
  ...contactTypeProperties
81
81
  },
82
82
  async execute({ [contactTypeName]: contact }, { client, service }, emit) {
83
- const contactData = (await service.trigger({ type: 'get' + contactTypeUName }, {
84
- [contactTypeName]: contact,
85
- }))[0]
83
+ const contactData = await app.viewGet('get'+contactTypeUName, { [contactType]: contact })
84
+ if(!contactData) throw { properties: { email: 'notFound' } }
86
85
  const { user } = contactData
87
86
  const messageData = { user }
88
87
  const actionProperties = { user }
package/signIn.js CHANGED
@@ -27,15 +27,14 @@ for(const contactType of config.contactTypes) {
27
27
  ...secretProperties
28
28
  },
29
29
  async execute({ [contactTypeName]: contact, passwordHash }, { client, service }, emit) {
30
- const contactData = (await service.trigger({ type: 'get' + contactTypeUName }, {
31
- [contactType]: contact,
32
- }))[0]
30
+ const contactData = await app.viewGet('get'+contactTypeUName, { [contactType]: contact })
31
+ if(!contactData) throw { properties: { email: 'notFound' } }
33
32
  const { user } = contactData
34
33
  if(passwordHash) { // login with password
35
34
  console.log("USER!", user)
36
35
  const passwordAuthenticationData = await PasswordAuthentication.get(user)
37
36
  console.log("PASSWORD AUTH!", passwordAuthenticationData)
38
- if(!passwordAuthenticationData || passwordAuthenticationData.passwordHash != passwordHash)
37
+ if(!passwordAuthenticationData || passwordAuthenticationData.passwordHash !== passwordHash)
39
38
  throw { properties: { passwordHash: 'wrongPassword' } }
40
39
  const { session } = client
41
40
  await service.trigger({ type: 'signIn' }, {