@live-change/password-authentication-service 0.8.31 → 0.8.33
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.
- package/package.json +3 -3
- package/reset.js +3 -6
- 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.
|
|
3
|
+
"version": "0.8.33",
|
|
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.
|
|
25
|
+
"@live-change/framework": "^0.8.33",
|
|
26
26
|
"nodemailer": "^6.7.2"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "98ff6f9c09e5fc1f408010df6cc8038eff571276"
|
|
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
|
-
|
|
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,
|