@truedat/auth 4.31.8 → 4.33.1
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/CHANGELOG.md +6 -0
- package/package.json +4 -4
- package/src/messages/en.js +2 -0
- package/src/messages/es.js +2 -0
- package/src/users/components/UserForm.js +21 -0
- package/src/users/components/__tests__/EditUser.spec.js +6 -4
- package/src/users/components/__tests__/InitialUser.spec.js +5 -3
- package/src/users/components/__tests__/NewUser.spec.js +5 -3
- package/src/users/components/__tests__/UserForm.spec.js +9 -6
- package/src/users/components/__tests__/__snapshots__/EditUser.spec.js.snap +20 -0
- package/src/users/components/__tests__/__snapshots__/InitialUser.spec.js.snap +20 -0
- package/src/users/components/__tests__/__snapshots__/NewUser.spec.js.snap +20 -0
- package/src/users/components/__tests__/__snapshots__/UserForm.spec.js.snap +20 -0
- package/src/users/reducers/user.js +3 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/auth",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.33.1",
|
|
4
4
|
"description": "Truedat Web Auth",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.14.1",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.
|
|
37
|
+
"@truedat/test": "4.33.1",
|
|
38
38
|
"babel-jest": "^27.0.6",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@truedat/core": "4.
|
|
85
|
+
"@truedat/core": "4.33.1",
|
|
86
86
|
"auth0-js": "^9.12.2",
|
|
87
87
|
"immutable": "^4.0.0-rc.12",
|
|
88
88
|
"jwt-decode": "^2.2.0",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"react-dom": ">= 16.8.6 < 17",
|
|
105
105
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "0fda4a132dfb5e386ad02d6e6a2ac3cfa58bc1ba"
|
|
108
108
|
}
|
package/src/messages/en.js
CHANGED
|
@@ -160,12 +160,14 @@ export default {
|
|
|
160
160
|
"user.actions.edit_password": "Change password",
|
|
161
161
|
"user.form.check_something": "Form validations failed...",
|
|
162
162
|
"user.form.email": "Email",
|
|
163
|
+
"user.form.external_id": "External ID",
|
|
163
164
|
"user.form.full_name": "Full Name",
|
|
164
165
|
"user.form.groups": "Groups",
|
|
165
166
|
"user.form.password": "Password",
|
|
166
167
|
"user.form.password_confirmation": "Password confirmation",
|
|
167
168
|
"user.form.password_confirmation.invalid": "Value does not match password",
|
|
168
169
|
"user.form.placeholder.email": "jane.doe@truedat.net",
|
|
170
|
+
"user.form.placeholder.external_id": "jane.doe (optional)",
|
|
169
171
|
"user.form.placeholder.full_name": "Jane Doe",
|
|
170
172
|
"user.form.placeholder.groups": "Select groups…",
|
|
171
173
|
"user.form.placeholder.user_name": "jane01",
|
package/src/messages/es.js
CHANGED
|
@@ -161,12 +161,14 @@ export default {
|
|
|
161
161
|
"user.actions.edit_password": "Cambiar contraseña",
|
|
162
162
|
"user.form.check_something": "Existen errores en el formulario",
|
|
163
163
|
"user.form.email": "Email",
|
|
164
|
+
"user.form.external_id": "Id externo",
|
|
164
165
|
"user.form.full_name": "Nombre completo",
|
|
165
166
|
"user.form.groups": "Grupos",
|
|
166
167
|
"user.form.password": "Contraseña",
|
|
167
168
|
"user.form.password_confirmation": "Confirmar contraseña",
|
|
168
169
|
"user.form.password_confirmation.invalid": "El valor introducido no coincide con la contraseña",
|
|
169
170
|
"user.form.placeholder.email": "elena.leon@truedat.net",
|
|
171
|
+
"user.form.placeholder.external_id": "elena.leon",
|
|
170
172
|
"user.form.placeholder.full_name": "Elena León",
|
|
171
173
|
"user.form.placeholder.groups": "Seleccionar grupos…",
|
|
172
174
|
"user.form.placeholder.user_name": "elena01",
|
|
@@ -117,6 +117,7 @@ export const UserForm = ({ isSubmitting, onSubmit, user, groups }) => {
|
|
|
117
117
|
mode: "all",
|
|
118
118
|
defaultValues: {
|
|
119
119
|
user_name: "",
|
|
120
|
+
external_id: "",
|
|
120
121
|
email: "",
|
|
121
122
|
full_name: "",
|
|
122
123
|
role: "user",
|
|
@@ -157,6 +158,26 @@ export const UserForm = ({ isSubmitting, onSubmit, user, groups }) => {
|
|
|
157
158
|
/>
|
|
158
159
|
)}
|
|
159
160
|
/>
|
|
161
|
+
<Controller
|
|
162
|
+
control={control}
|
|
163
|
+
name="external_id"
|
|
164
|
+
render={({ onBlur, onChange, value }) => (
|
|
165
|
+
<Form.Input
|
|
166
|
+
id="external_id"
|
|
167
|
+
autoComplete="off"
|
|
168
|
+
label={{
|
|
169
|
+
children: formatMessage({ id: "user.form.external_id" }),
|
|
170
|
+
htmlFor: "external_id",
|
|
171
|
+
}}
|
|
172
|
+
onBlur={onBlur}
|
|
173
|
+
onChange={(_e, { value }) => onChange(value)}
|
|
174
|
+
placeholder={formatMessage({
|
|
175
|
+
id: "user.form.placeholder.external_id",
|
|
176
|
+
})}
|
|
177
|
+
value={value || ""}
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
180
|
+
/>
|
|
160
181
|
<Controller
|
|
161
182
|
control={control}
|
|
162
183
|
name="email"
|
|
@@ -12,12 +12,14 @@ const renderOpts = {
|
|
|
12
12
|
"form.validation.required": "{prop} required",
|
|
13
13
|
"navigation.members.users": "Users",
|
|
14
14
|
"user.form.email": "Email address",
|
|
15
|
+
"user.form.external_id": "External ID",
|
|
15
16
|
"user.form.full_name": "Full name",
|
|
16
17
|
"user.form.groups": "Groups",
|
|
17
18
|
"user.form.password": "password",
|
|
18
19
|
"user.form.user_name": "Username",
|
|
19
20
|
"user.form.password_confirmation": "confirm",
|
|
20
21
|
"user.form.placeholder.email": "pperez@example.com",
|
|
22
|
+
"user.form.placeholder.external_id": "pperez",
|
|
21
23
|
"user.form.placeholder.full_name": "Pepe Perez",
|
|
22
24
|
"user.form.placeholder.user_name": "pperez",
|
|
23
25
|
"user.form.placeholder.groups": "Madrid DG",
|
|
@@ -26,12 +28,12 @@ const renderOpts = {
|
|
|
26
28
|
"user.type.service": "service",
|
|
27
29
|
"user.type.user": "user",
|
|
28
30
|
"users.actions.create": "create",
|
|
29
|
-
"users.actions.edit": "edit"
|
|
30
|
-
}
|
|
31
|
+
"users.actions.edit": "edit",
|
|
32
|
+
},
|
|
31
33
|
},
|
|
32
34
|
state: {
|
|
33
|
-
user: { id: 123, user_name: "fred", full_name: "fredrik foobar" }
|
|
34
|
-
}
|
|
35
|
+
user: { id: 123, user_name: "fred", full_name: "fredrik foobar" },
|
|
36
|
+
},
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
describe("<EditUser />", () => {
|
|
@@ -12,21 +12,23 @@ const renderOpts = {
|
|
|
12
12
|
"form.validation.required": "{prop} required",
|
|
13
13
|
"users.actions.create_admin_account": "Configure Admin Account",
|
|
14
14
|
"user.form.email": "Email address",
|
|
15
|
+
"user.form.external_id": "External ID",
|
|
15
16
|
"user.form.full_name": "Full name",
|
|
16
17
|
"user.form.groups": "Groups",
|
|
17
18
|
"user.form.password": "password",
|
|
18
19
|
"user.form.user_name": "Username",
|
|
19
20
|
"user.form.password_confirmation": "confirm",
|
|
20
21
|
"user.form.placeholder.email": "pperez@example.com",
|
|
22
|
+
"user.form.placeholder.external_id": "pperez",
|
|
21
23
|
"user.form.placeholder.full_name": "Pepe Perez",
|
|
22
24
|
"user.form.placeholder.user_name": "pperez",
|
|
23
25
|
"user.form.placeholder.groups": "Madrid DG",
|
|
24
26
|
"user.form.role": "role",
|
|
25
27
|
"user.type.admin": "admin",
|
|
26
28
|
"user.type.service": "service",
|
|
27
|
-
"user.type.user": "user"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
29
|
+
"user.type.user": "user",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
describe("<InitialUser />", () => {
|
|
@@ -12,12 +12,14 @@ const renderOpts = {
|
|
|
12
12
|
"form.validation.required": "{prop} required",
|
|
13
13
|
"navigation.members.users": "Users",
|
|
14
14
|
"user.form.email": "Email address",
|
|
15
|
+
"user.form.external_id": "External ID",
|
|
15
16
|
"user.form.full_name": "Full name",
|
|
16
17
|
"user.form.groups": "Groups",
|
|
17
18
|
"user.form.password": "password",
|
|
18
19
|
"user.form.user_name": "Username",
|
|
19
20
|
"user.form.password_confirmation": "confirm",
|
|
20
21
|
"user.form.placeholder.email": "pperez@example.com",
|
|
22
|
+
"user.form.placeholder.external_id": "pperez",
|
|
21
23
|
"user.form.placeholder.full_name": "Pepe Perez",
|
|
22
24
|
"user.form.placeholder.user_name": "pperez",
|
|
23
25
|
"user.form.placeholder.groups": "Madrid DG",
|
|
@@ -25,9 +27,9 @@ const renderOpts = {
|
|
|
25
27
|
"user.type.admin": "admin",
|
|
26
28
|
"user.type.service": "service",
|
|
27
29
|
"user.type.user": "user",
|
|
28
|
-
"users.actions.create": "create"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
30
|
+
"users.actions.create": "create",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
describe("<NewUser />", () => {
|
|
@@ -13,6 +13,7 @@ const renderOpts = {
|
|
|
13
13
|
"form.validation.required": "{prop} required",
|
|
14
14
|
"navigation.members.users": "Users",
|
|
15
15
|
"user.form.email": "Email address",
|
|
16
|
+
"user.form.external_id": "External ID",
|
|
16
17
|
"user.form.full_name": "Full name",
|
|
17
18
|
"user.form.groups": "Groups",
|
|
18
19
|
"user.form.password": "password",
|
|
@@ -20,6 +21,7 @@ const renderOpts = {
|
|
|
20
21
|
"user.form.password_confirmation": "confirm",
|
|
21
22
|
"user.form.password_confirmation.invalid": "Does not match",
|
|
22
23
|
"user.form.placeholder.email": "pperez@example.com",
|
|
24
|
+
"user.form.placeholder.external_id": "pperez",
|
|
23
25
|
"user.form.placeholder.full_name": "Pepe Perez",
|
|
24
26
|
"user.form.placeholder.user_name": "pperez",
|
|
25
27
|
"user.form.placeholder.groups": "Madrid DG",
|
|
@@ -28,12 +30,12 @@ const renderOpts = {
|
|
|
28
30
|
"user.type.service": "service",
|
|
29
31
|
"user.type.user": "user",
|
|
30
32
|
"users.actions.create": "create",
|
|
31
|
-
"users.actions.edit": "edit"
|
|
32
|
-
}
|
|
33
|
+
"users.actions.edit": "edit",
|
|
34
|
+
},
|
|
33
35
|
},
|
|
34
36
|
state: {
|
|
35
|
-
user: { id: 123, user_name: "fred", full_name: "fredrik foobar" }
|
|
36
|
-
}
|
|
37
|
+
user: { id: 123, user_name: "fred", full_name: "fredrik foobar" },
|
|
38
|
+
},
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
describe("<UserForm />", () => {
|
|
@@ -45,7 +47,7 @@ describe("<UserForm />", () => {
|
|
|
45
47
|
it("calls the onSubmit function when submitted", async () => {
|
|
46
48
|
const onSubmit = jest.fn();
|
|
47
49
|
const { getByRole, findByRole, findByText } = render(
|
|
48
|
-
<UserForm onSubmit={props => onSubmit(props)} />,
|
|
50
|
+
<UserForm onSubmit={(props) => onSubmit(props)} />,
|
|
49
51
|
renderOpts
|
|
50
52
|
);
|
|
51
53
|
|
|
@@ -75,12 +77,13 @@ describe("<UserForm />", () => {
|
|
|
75
77
|
await waitFor(() =>
|
|
76
78
|
expect(onSubmit).toHaveBeenCalledWith({
|
|
77
79
|
email: "",
|
|
80
|
+
external_id: "",
|
|
78
81
|
full_name: "Fred",
|
|
79
82
|
groups: [],
|
|
80
83
|
password: "abc123456",
|
|
81
84
|
rep_password: "abc123456",
|
|
82
85
|
role: "admin",
|
|
83
|
-
user_name: "fred"
|
|
86
|
+
user_name: "fred",
|
|
84
87
|
})
|
|
85
88
|
);
|
|
86
89
|
});
|
|
@@ -61,6 +61,26 @@ exports[`<EditUser /> matches the latest snapshot 1`] = `
|
|
|
61
61
|
/>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
|
+
<div
|
|
65
|
+
class="field"
|
|
66
|
+
>
|
|
67
|
+
<label
|
|
68
|
+
for="external_id"
|
|
69
|
+
>
|
|
70
|
+
External ID
|
|
71
|
+
</label>
|
|
72
|
+
<div
|
|
73
|
+
class="ui input"
|
|
74
|
+
>
|
|
75
|
+
<input
|
|
76
|
+
autocomplete="off"
|
|
77
|
+
id="external_id"
|
|
78
|
+
placeholder="pperez"
|
|
79
|
+
type="text"
|
|
80
|
+
value=""
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
64
84
|
<div
|
|
65
85
|
class="field"
|
|
66
86
|
>
|
|
@@ -42,6 +42,26 @@ exports[`<InitialUser /> matches the latest snapshot 1`] = `
|
|
|
42
42
|
/>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
|
45
|
+
<div
|
|
46
|
+
class="field"
|
|
47
|
+
>
|
|
48
|
+
<label
|
|
49
|
+
for="external_id"
|
|
50
|
+
>
|
|
51
|
+
External ID
|
|
52
|
+
</label>
|
|
53
|
+
<div
|
|
54
|
+
class="ui input"
|
|
55
|
+
>
|
|
56
|
+
<input
|
|
57
|
+
autocomplete="off"
|
|
58
|
+
id="external_id"
|
|
59
|
+
placeholder="pperez"
|
|
60
|
+
type="text"
|
|
61
|
+
value=""
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
45
65
|
<div
|
|
46
66
|
class="field"
|
|
47
67
|
>
|
|
@@ -61,6 +61,26 @@ exports[`<NewUser /> matches the latest snapshot 1`] = `
|
|
|
61
61
|
/>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
|
+
<div
|
|
65
|
+
class="field"
|
|
66
|
+
>
|
|
67
|
+
<label
|
|
68
|
+
for="external_id"
|
|
69
|
+
>
|
|
70
|
+
External ID
|
|
71
|
+
</label>
|
|
72
|
+
<div
|
|
73
|
+
class="ui input"
|
|
74
|
+
>
|
|
75
|
+
<input
|
|
76
|
+
autocomplete="off"
|
|
77
|
+
id="external_id"
|
|
78
|
+
placeholder="pperez"
|
|
79
|
+
type="text"
|
|
80
|
+
value=""
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
64
84
|
<div
|
|
65
85
|
class="field"
|
|
66
86
|
>
|
|
@@ -26,6 +26,26 @@ exports[`<UserForm /> matches the latest snapshot 1`] = `
|
|
|
26
26
|
/>
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
29
|
+
<div
|
|
30
|
+
class="field"
|
|
31
|
+
>
|
|
32
|
+
<label
|
|
33
|
+
for="external_id"
|
|
34
|
+
>
|
|
35
|
+
External ID
|
|
36
|
+
</label>
|
|
37
|
+
<div
|
|
38
|
+
class="ui input"
|
|
39
|
+
>
|
|
40
|
+
<input
|
|
41
|
+
autocomplete="off"
|
|
42
|
+
id="external_id"
|
|
43
|
+
placeholder="pperez"
|
|
44
|
+
type="text"
|
|
45
|
+
value=""
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
29
49
|
<div
|
|
30
50
|
class="field"
|
|
31
51
|
>
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
fetchUser,
|
|
5
5
|
updateUser,
|
|
6
6
|
createUser,
|
|
7
|
-
updatePassword
|
|
7
|
+
updatePassword,
|
|
8
8
|
} from "../routines";
|
|
9
9
|
|
|
10
10
|
const initialState = {};
|
|
@@ -12,11 +12,12 @@ const initialState = {};
|
|
|
12
12
|
const pickFields = _.pick([
|
|
13
13
|
"id",
|
|
14
14
|
"user_name",
|
|
15
|
+
"external_id",
|
|
15
16
|
"role",
|
|
16
17
|
"groups",
|
|
17
18
|
"full_name",
|
|
18
19
|
"email",
|
|
19
|
-
"acls"
|
|
20
|
+
"acls",
|
|
20
21
|
]);
|
|
21
22
|
|
|
22
23
|
const user = (state = initialState, { type, payload }) => {
|