@live-change/password-authentication-service 0.8.30 → 0.8.32

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 +3 -6
  3. package/signIn.js +4 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/password-authentication-service",
3
- "version": "0.8.30",
3
+ "version": "0.8.32",
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.30",
25
+ "@live-change/framework": "^0.8.32",
26
26
  "nodemailer": "^6.7.2"
27
27
  },
28
- "gitHead": "aec2a3ede7fe490dcb7db40ee6c2963cd0c62af1"
28
+ "gitHead": "9ea7767670a99404794087726223064c45d798d3"
29
29
  }
package/reset.js CHANGED
@@ -80,15 +80,13 @@ 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({
84
- type: 'get' + contactTypeUName,
83
+ const contactData = (await service.trigger({ type: 'get' + contactTypeUName }, {
85
84
  [contactTypeName]: contact,
86
85
  }))[0]
87
86
  const { user } = contactData
88
87
  const messageData = { user }
89
88
  const actionProperties = { user }
90
- return (await service.trigger({
91
- type: 'authenticateWithMessage',
89
+ return (await service.trigger({ type: 'authenticateWithMessage' }, {
92
90
  contactType,
93
91
  contact,
94
92
  messageData,
@@ -116,8 +114,7 @@ definition.trigger({
116
114
  const key = randomString(config.resetKeyLength || 16)
117
115
  const expire = new Date()
118
116
  expire.setTime(Date.now() + (config.resetExpireTime || 1*60*60*1000))
119
- service.trigger({
120
- type: 'signIn',
117
+ service.trigger({ type: 'signIn' }, {
121
118
  user, session
122
119
  })
123
120
  emit({
package/signIn.js CHANGED
@@ -27,8 +27,7 @@ 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({
31
- type: 'get' + contactTypeUName,
30
+ const contactData = (await service.trigger({ type: 'get' + contactTypeUName }, {
32
31
  [contactType]: contact,
33
32
  }))[0]
34
33
  const { user } = contactData
@@ -39,8 +38,8 @@ for(const contactType of config.contactTypes) {
39
38
  if(!passwordAuthenticationData || passwordAuthenticationData.passwordHash != passwordHash)
40
39
  throw { properties: { passwordHash: 'wrongPassword' } }
41
40
  const { session } = client
42
- await service.trigger({
43
- type: 'signIn', user, session
41
+ await service.trigger({ type: 'signIn' }, {
42
+ user, session
44
43
  })
45
44
  return user
46
45
  } else { // login without password - with message
@@ -48,8 +47,7 @@ for(const contactType of config.contactTypes) {
48
47
  const messageData = {
49
48
  user
50
49
  }
51
- const results = await service.trigger({
52
- type: 'authenticateWithMessage',
50
+ const results = await service.trigger({ type: 'authenticateWithMessage' }, {
53
51
  contactType,
54
52
  contact,
55
53
  messageData,