@drax/identity-front 3.13.0 → 3.15.0
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 +4 -4
- package/src/i18n/identity-permissions-i18n.ts +11 -11
- package/src/i18n/identity-validation-i18n.ts +16 -0
- package/src/index.ts +2 -0
- package/src/interfaces/IAuthProvider.ts +2 -0
- package/src/interfaces/IPasswordPolicy.ts +13 -0
- package/src/providers/gql/AuthGqlProvider.ts +5 -0
- package/src/providers/rest/AuthRestProvider.ts +6 -0
- package/src/system/AuthSystem.ts +6 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.15.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@drax/common-front": "^3.11.0",
|
|
23
|
-
"@drax/crud-share": "^3.
|
|
24
|
-
"@drax/identity-share": "^3.
|
|
23
|
+
"@drax/crud-share": "^3.14.0",
|
|
24
|
+
"@drax/identity-share": "^3.15.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@tsconfig/node20": "^20.1.4",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"vite": "^7.3.1",
|
|
31
31
|
"vitest": "^3.2.4"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "a3bd3419f580b111b26da9e6be2e1cc4c75a056e"
|
|
34
34
|
}
|
|
@@ -16,11 +16,11 @@ const messages = {
|
|
|
16
16
|
'user:switchTenant': 'Switch Tenant',
|
|
17
17
|
'user:changePassword': 'Change Password',
|
|
18
18
|
|
|
19
|
-
'userApiKey:view': 'View
|
|
20
|
-
'userApiKey:
|
|
21
|
-
'userApiKey:create': 'Create ApiKey',
|
|
22
|
-
'userApiKey:update': 'Edit ApiKey',
|
|
23
|
-
'userApiKey:delete': 'Delete ApiKey',
|
|
19
|
+
'userApiKey:view': 'View my ApiKeys',
|
|
20
|
+
'userApiKey:viewAll': 'View all ApiKey',
|
|
21
|
+
'userApiKey:create': 'Create my ApiKey',
|
|
22
|
+
'userApiKey:update': 'Edit my ApiKey',
|
|
23
|
+
'userApiKey:delete': 'Delete my ApiKey',
|
|
24
24
|
'userApiKey:manage': 'Manage ApiKey',
|
|
25
25
|
|
|
26
26
|
'role:view': 'View Role',
|
|
@@ -55,12 +55,12 @@ const messages = {
|
|
|
55
55
|
'user:switchTenant': 'Cambiar Tenant',
|
|
56
56
|
'user:changePassword': 'Cambiar Password',
|
|
57
57
|
|
|
58
|
-
'userApiKey:view': 'Ver
|
|
59
|
-
'userApiKey:
|
|
60
|
-
'userApiKey:create': 'Crear ApiKey',
|
|
61
|
-
'userApiKey:update': 'Editar ApiKey',
|
|
62
|
-
'userApiKey:delete': 'Eliminar ApiKey',
|
|
63
|
-
'userApiKey:manage': 'Administrar ApiKey',
|
|
58
|
+
'userApiKey:view': 'Ver mis ApiKeys',
|
|
59
|
+
'userApiKey:viewAll': 'Ver todas las ApiKeys',
|
|
60
|
+
'userApiKey:create': 'Crear mis ApiKey',
|
|
61
|
+
'userApiKey:update': 'Editar mis ApiKey',
|
|
62
|
+
'userApiKey:delete': 'Eliminar mis ApiKey',
|
|
63
|
+
'userApiKey:manage': 'Administrar mis ApiKey',
|
|
64
64
|
|
|
65
65
|
'role:view': 'Ver Rol',
|
|
66
66
|
'role:create': 'Crear Rol',
|
|
@@ -6,8 +6,16 @@ const messages = {
|
|
|
6
6
|
},
|
|
7
7
|
password: {
|
|
8
8
|
min8: 'Password must be at least 8 characters long',
|
|
9
|
+
minLength: 'Password does not meet the minimum length',
|
|
9
10
|
max32: 'Password must be at most 32 characters long',
|
|
10
11
|
max64: 'Password must be at most 64 characters long',
|
|
12
|
+
maxLength: 'Password exceeds the maximum length',
|
|
13
|
+
requireUppercase: 'Password must contain at least one uppercase letter',
|
|
14
|
+
requireLowercase: 'Password must contain at least one lowercase letter',
|
|
15
|
+
requireNumber: 'Password must contain at least one number',
|
|
16
|
+
requireSpecialChar: 'Password must contain at least one special character',
|
|
17
|
+
disallowSpaces: 'Password cannot contain spaces',
|
|
18
|
+
preventReuse: 'Password cannot be the same as a recently used password',
|
|
11
19
|
confirmed: 'Passwords do not match',
|
|
12
20
|
currentDifferent: 'New password must be different from current password'
|
|
13
21
|
},
|
|
@@ -20,8 +28,16 @@ const messages = {
|
|
|
20
28
|
},
|
|
21
29
|
password:{
|
|
22
30
|
min8: 'La contraseña debe tener al menos 8 caracteres',
|
|
31
|
+
minLength: 'La contraseña no cumple con la longitud minima',
|
|
23
32
|
max32: 'La contraseña debe tener como maximo 32 caracteres',
|
|
24
33
|
max64: 'La contraseña debe tener como maximo 64 caracteres',
|
|
34
|
+
maxLength: 'La contraseña supera la longitud maxima',
|
|
35
|
+
requireUppercase: 'La contraseña debe contener al menos una letra mayuscula',
|
|
36
|
+
requireLowercase: 'La contraseña debe contener al menos una letra minuscula',
|
|
37
|
+
requireNumber: 'La contraseña debe contener al menos un numero',
|
|
38
|
+
requireSpecialChar: 'La contraseña debe contener al menos un caracter especial',
|
|
39
|
+
disallowSpaces: 'La contraseña no puede contener espacios',
|
|
40
|
+
preventReuse: 'La contraseña no puede ser igual a una usada recientemente',
|
|
25
41
|
confirmed: 'Las contraseñas no coinciden',
|
|
26
42
|
currentDifferent: 'Nueva contraseña debe ser diferente de la actual'
|
|
27
43
|
},
|
package/src/index.ts
CHANGED
|
@@ -50,6 +50,7 @@ import type {IUserApiKeyProvider} from "./interfaces/IUserApiKeyProvider"
|
|
|
50
50
|
import type {IAuthFullUser} from "./interfaces/IAuthFullUser"
|
|
51
51
|
import type {IUserPassword} from "./interfaces/IUserPassword"
|
|
52
52
|
import type {ILoginResponse} from "./interfaces/ILoginResponse"
|
|
53
|
+
import type {IPasswordPolicy} from "./interfaces/IPasswordPolicy"
|
|
53
54
|
import type {IUserRegistration} from "./interfaces/IUserRegistration"
|
|
54
55
|
|
|
55
56
|
export type {
|
|
@@ -61,6 +62,7 @@ export type {
|
|
|
61
62
|
IAuthFullUser,
|
|
62
63
|
IUserPassword,
|
|
63
64
|
ILoginResponse,
|
|
65
|
+
IPasswordPolicy,
|
|
64
66
|
IUserRegistration
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {IAuthFullUser} from "./IAuthFullUser";
|
|
2
2
|
import type {ILoginResponse} from "./ILoginResponse";
|
|
3
|
+
import type {IPasswordPolicy} from "./IPasswordPolicy";
|
|
3
4
|
import type {IUserRegistration} from "./IUserRegistration";
|
|
4
5
|
|
|
5
6
|
interface IAuthProvider {
|
|
@@ -7,6 +8,7 @@ interface IAuthProvider {
|
|
|
7
8
|
me(): Promise<IAuthFullUser>
|
|
8
9
|
switchTenant(tenantId: string): Promise<ILoginResponse>
|
|
9
10
|
logout(): void
|
|
11
|
+
passwordPolicy(): Promise<IPasswordPolicy>
|
|
10
12
|
changeOwnPassword(currentPassword:string, newPassword:string):Promise<boolean>
|
|
11
13
|
recoveryPasswordRequest(email:string):Promise<boolean>
|
|
12
14
|
recoveryPasswordComplete(recoveryCode:string, newPassword:string):Promise<boolean>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface IPasswordPolicy {
|
|
2
|
+
minLength: number
|
|
3
|
+
maxLength: number
|
|
4
|
+
requireUppercase: boolean
|
|
5
|
+
requireLowercase: boolean
|
|
6
|
+
requireNumber: boolean
|
|
7
|
+
requireSpecialChar: boolean
|
|
8
|
+
disallowSpaces: boolean
|
|
9
|
+
preventReuse: number
|
|
10
|
+
expirationDays: number | null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type {IPasswordPolicy}
|
|
@@ -2,6 +2,7 @@ import type {IGqlClient} from '@drax/common-front'
|
|
|
2
2
|
import type {IAuthProvider} from "../../interfaces/IAuthProvider.ts";
|
|
3
3
|
import type {IAuthFullUser} from "../../interfaces/IAuthFullUser";
|
|
4
4
|
import type {ILoginResponse} from "../../interfaces/ILoginResponse";
|
|
5
|
+
import type {IPasswordPolicy} from "../../interfaces/IPasswordPolicy";
|
|
5
6
|
import type {IUserRegistration} from "../../interfaces/IUserRegistration";
|
|
6
7
|
|
|
7
8
|
class AuthGqlProvider implements IAuthProvider {
|
|
@@ -49,6 +50,10 @@ class AuthGqlProvider implements IAuthProvider {
|
|
|
49
50
|
return data.me
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
passwordPolicy(): Promise<IPasswordPolicy> {
|
|
54
|
+
throw new Error('Not implemented')
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
async changeOwnPassword(currentPassword: string, newPassword: string): Promise<boolean> {
|
|
53
58
|
const query: string = `mutation changeOwnPassword($currentPassword: String!, $newPassword: String!)
|
|
54
59
|
{ changeOwnPassword(currentPassword: $currentPassword, newPassword: $newPassword) }`
|
|
@@ -3,6 +3,7 @@ import type {IHttpClient} from '@drax/common-front'
|
|
|
3
3
|
import type {IAuthProvider} from "../../interfaces/IAuthProvider";
|
|
4
4
|
import type {IAuthFullUser} from "../../interfaces/IAuthFullUser";
|
|
5
5
|
import type {ILoginResponse} from "../../interfaces/ILoginResponse";
|
|
6
|
+
import type {IPasswordPolicy} from "../../interfaces/IPasswordPolicy";
|
|
6
7
|
import type {IUserRegistration} from "../../interfaces/IUserRegistration";
|
|
7
8
|
|
|
8
9
|
|
|
@@ -48,6 +49,11 @@ class AuthRestProvider implements IAuthProvider {
|
|
|
48
49
|
return r
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
async passwordPolicy(): Promise<IPasswordPolicy> {
|
|
53
|
+
const url = '/api/auth/password-policy'
|
|
54
|
+
return await this.httpClient.get(url) as IPasswordPolicy
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
async changeOwnPassword(currentPassword: string, newPassword: string): Promise<boolean> {
|
|
52
58
|
const url = '/api/users/password/change'
|
|
53
59
|
const data = {currentPassword, newPassword}
|
package/src/system/AuthSystem.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {IAuthProvider} from "../interfaces/IAuthProvider";
|
|
2
2
|
import type {IAuthFullUser} from "../interfaces/IAuthFullUser";
|
|
3
3
|
import type {ILoginResponse} from "../interfaces/ILoginResponse";
|
|
4
|
+
import type {IPasswordPolicy} from "../interfaces/IPasswordPolicy";
|
|
4
5
|
import type {IUserRegistration} from "../interfaces/IUserRegistration";
|
|
5
6
|
|
|
6
7
|
class AuthSystem implements IAuthProvider {
|
|
@@ -31,6 +32,11 @@ class AuthSystem implements IAuthProvider {
|
|
|
31
32
|
return authUser
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
async passwordPolicy():Promise<IPasswordPolicy> {
|
|
36
|
+
const result: IPasswordPolicy = await this._provider.passwordPolicy()
|
|
37
|
+
return result
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
async changeOwnPassword(currentPassword:string, newPassword:string):Promise<boolean> {
|
|
35
41
|
const result: boolean = await this._provider.changeOwnPassword(currentPassword,newPassword)
|
|
36
42
|
return result
|