@live-change/password-authentication-service 0.9.114 → 0.9.116
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/change.js +3 -3
- package/model.js +7 -4
- package/package.json +3 -3
- package/reset.js +1 -1
- package/signIn.js +1 -1
package/change.js
CHANGED
|
@@ -5,7 +5,7 @@ definition.action({
|
|
|
5
5
|
name: 'setPassword',
|
|
6
6
|
waitForEvents: true,
|
|
7
7
|
properties: {
|
|
8
|
-
...secretProperties
|
|
8
|
+
...secretProperties(true)
|
|
9
9
|
},
|
|
10
10
|
access: (params, { client }) => {
|
|
11
11
|
return !!client.user
|
|
@@ -25,8 +25,8 @@ definition.action({
|
|
|
25
25
|
name: 'changePassword',
|
|
26
26
|
waitForEvents: true,
|
|
27
27
|
properties: {
|
|
28
|
-
currentPasswordHash: secretProperties.passwordHash,
|
|
29
|
-
...secretProperties
|
|
28
|
+
currentPasswordHash: secretProperties(true).passwordHash,
|
|
29
|
+
...secretProperties(true)
|
|
30
30
|
},
|
|
31
31
|
access: (params, { client }) => {
|
|
32
32
|
return !!client.user
|
package/model.js
CHANGED
|
@@ -2,15 +2,18 @@ import crypto from 'crypto'
|
|
|
2
2
|
import definition from './definition.js'
|
|
3
3
|
const config = definition.config
|
|
4
4
|
|
|
5
|
-
const secretProperties = {
|
|
5
|
+
const secretProperties = (required = true) => ({
|
|
6
6
|
passwordHash: {
|
|
7
7
|
type: String,
|
|
8
8
|
secret: true,
|
|
9
9
|
preFilter: config.passwordHash ||
|
|
10
10
|
(password => password && crypto.createHash('sha256').update(password).digest('hex')),
|
|
11
|
-
validation: [
|
|
11
|
+
validation: [
|
|
12
|
+
...(required ? ['nonEmpty'] : []),
|
|
13
|
+
...(config.passwordValidation || ['password']),
|
|
14
|
+
]
|
|
12
15
|
},
|
|
13
|
-
}
|
|
16
|
+
})
|
|
14
17
|
|
|
15
18
|
const PasswordAuthentication = definition.model({
|
|
16
19
|
name: 'PasswordAuthentication',
|
|
@@ -20,7 +23,7 @@ const PasswordAuthentication = definition.model({
|
|
|
20
23
|
]
|
|
21
24
|
},
|
|
22
25
|
properties: {
|
|
23
|
-
...secretProperties,
|
|
26
|
+
...secretProperties(true),
|
|
24
27
|
}
|
|
25
28
|
})
|
|
26
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/password-authentication-service",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.116",
|
|
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.9.
|
|
25
|
+
"@live-change/framework": "^0.9.116",
|
|
26
26
|
"nodemailer": "^6.7.2"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "88622801d3ba2cfd1742059b7839d7b751ac25f2"
|
|
29
29
|
}
|
package/reset.js
CHANGED
|
@@ -135,7 +135,7 @@ definition.action({
|
|
|
135
135
|
type: String,
|
|
136
136
|
validation: ['nonEmpty']
|
|
137
137
|
},
|
|
138
|
-
...secretProperties
|
|
138
|
+
...secretProperties(true)
|
|
139
139
|
},
|
|
140
140
|
async execute({ key, passwordHash }, { client, service }, emit) {
|
|
141
141
|
const resetPasswordAuthenticationData = await ResetPasswordAuthentication.indexObjectGet('byKey', key)
|
package/signIn.js
CHANGED
|
@@ -26,7 +26,7 @@ for(const contactType of config.contactTypes) {
|
|
|
26
26
|
waitForEvents: true,
|
|
27
27
|
properties: {
|
|
28
28
|
...contactTypeProperties,
|
|
29
|
-
...secretProperties
|
|
29
|
+
...secretProperties(false)
|
|
30
30
|
},
|
|
31
31
|
async execute({ [contactTypeName]: contact, passwordHash }, { client, service }, emit) {
|
|
32
32
|
const contactData = await app.viewGet('get'+contactTypeUName, { [contactType]: contact })
|