@movalib/movalib-commons 1.1.76 → 1.1.78
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.
|
@@ -215,7 +215,7 @@ var AccountValidation = function (_a) {
|
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(emptyPwd || smsValidation || resetPassword) &&
|
|
218
|
-
(0, jsx_runtime_1.jsx)(MovaDialog_1.default, __assign({ leafImageColor: 'pink', titleStyle: getTitleStyle(), fullScreen: isMobile, open: emptyPwd || smsValidation, closable: false, onClose: function () {
|
|
218
|
+
(0, jsx_runtime_1.jsx)(MovaDialog_1.default, __assign({ leafImageColor: 'pink', titleStyle: getTitleStyle(), fullScreen: isMobile, open: emptyPwd || smsValidation || resetPassword, closable: false, onClose: function () {
|
|
219
219
|
throw new Error('Function not implemented.');
|
|
220
220
|
}, actions: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, __assign({ type: "submit", onClick: handleValidateAccount, fullWidth: true, variant: "contained", sx: { mt: 4, mb: 0 } }, { children: resetPassword ? (0, jsx_runtime_1.jsx)("span", { children: "R\u00E9initialiser mon mot de passe" }) : (0, jsx_runtime_1.jsx)("span", { children: "Activer mon compte" }) })) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: {
|
|
221
221
|
display: 'flex',
|
|
@@ -3,5 +3,5 @@ import { MovaAppType } from "../helpers/Enums";
|
|
|
3
3
|
import User from "../models/User";
|
|
4
4
|
export default class AuthenticationService {
|
|
5
5
|
static forgotPassword(req: any): Promise<APIResponse<string>>;
|
|
6
|
-
static login(appType: MovaAppType,
|
|
6
|
+
static login(appType: MovaAppType, phoneEmail: string, password: string): Promise<APIResponse<User>>;
|
|
7
7
|
}
|
|
@@ -58,34 +58,40 @@ var AuthenticationService = /** @class */ (function () {
|
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
AuthenticationService.login = function (appType,
|
|
61
|
+
AuthenticationService.login = function (appType, phoneEmail, password) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var url, tokenCookie, tokenResponse, userResponse, errorMsg, error_1, errorMessage;
|
|
63
|
+
var url, tokenCookie, req, tokenResponse, userResponse, errorMsg, error_1, errorMessage;
|
|
64
64
|
return __generator(this, function (_a) {
|
|
65
65
|
switch (_a.label) {
|
|
66
66
|
case 0:
|
|
67
67
|
_a.trys.push([0, 5, , 6]);
|
|
68
68
|
url = '';
|
|
69
69
|
tokenCookie = '';
|
|
70
|
+
req = void 0;
|
|
70
71
|
Logger_1.default.info(ApiHelper_1.API_BASE_URL);
|
|
71
72
|
switch (appType) {
|
|
72
73
|
case Enums_1.MovaAppType.GARAGE:
|
|
73
74
|
url = "".concat(ApiHelper_1.API_BASE_URL, "/garage/login");
|
|
74
75
|
tokenCookie = CookieUtils_1.COOKIE_PRO_TOKEN;
|
|
76
|
+
req = {
|
|
77
|
+
email: phoneEmail,
|
|
78
|
+
password: password
|
|
79
|
+
};
|
|
75
80
|
break;
|
|
76
81
|
case Enums_1.MovaAppType.INDIVIDUAL:
|
|
77
82
|
url = "".concat(ApiHelper_1.API_BASE_URL, "/login");
|
|
78
83
|
tokenCookie = CookieUtils_1.COOKIE_INDIVIDUAL_TOKEN;
|
|
84
|
+
req = {
|
|
85
|
+
phoneEmail: phoneEmail,
|
|
86
|
+
password: password
|
|
87
|
+
};
|
|
79
88
|
break;
|
|
80
89
|
}
|
|
81
90
|
return [4 /*yield*/, (0, ApiHelper_1.request)({
|
|
82
91
|
url: url,
|
|
83
92
|
method: Enums_1.APIMethod.POST,
|
|
84
93
|
appType: appType,
|
|
85
|
-
body: JSON.stringify(
|
|
86
|
-
email: email,
|
|
87
|
-
password: password
|
|
88
|
-
})
|
|
94
|
+
body: JSON.stringify(req)
|
|
89
95
|
})];
|
|
90
96
|
case 1:
|
|
91
97
|
tokenResponse = _a.sent();
|
package/package.json
CHANGED
|
@@ -257,7 +257,7 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
|
|
|
257
257
|
leafImageColor='pink'
|
|
258
258
|
titleStyle={getTitleStyle()}
|
|
259
259
|
fullScreen={isMobile}
|
|
260
|
-
open={emptyPwd || smsValidation}
|
|
260
|
+
open={emptyPwd || smsValidation || resetPassword}
|
|
261
261
|
closable={false}
|
|
262
262
|
onClose={function (): void {
|
|
263
263
|
throw new Error('Function not implemented.');
|
|
@@ -15,12 +15,13 @@ export default class AuthenticationService {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
static async login(appType: MovaAppType,
|
|
18
|
+
static async login(appType: MovaAppType, phoneEmail: string, password: string): Promise<APIResponse<User>> {
|
|
19
19
|
try {
|
|
20
20
|
|
|
21
21
|
// Contextualisation selon l'application demandeuse
|
|
22
22
|
let url = '';
|
|
23
23
|
let tokenCookie = '';
|
|
24
|
+
let req;
|
|
24
25
|
|
|
25
26
|
Logger.info(API_BASE_URL);
|
|
26
27
|
|
|
@@ -28,10 +29,18 @@ export default class AuthenticationService {
|
|
|
28
29
|
case MovaAppType.GARAGE:
|
|
29
30
|
url = `${API_BASE_URL}/garage/login`;
|
|
30
31
|
tokenCookie = COOKIE_PRO_TOKEN;
|
|
32
|
+
req = {
|
|
33
|
+
email : phoneEmail,
|
|
34
|
+
password: password
|
|
35
|
+
}
|
|
31
36
|
break;
|
|
32
37
|
case MovaAppType.INDIVIDUAL:
|
|
33
38
|
url = `${API_BASE_URL}/login`;
|
|
34
39
|
tokenCookie = COOKIE_INDIVIDUAL_TOKEN;
|
|
40
|
+
req = {
|
|
41
|
+
phoneEmail : phoneEmail,
|
|
42
|
+
password: password
|
|
43
|
+
}
|
|
35
44
|
break;
|
|
36
45
|
}
|
|
37
46
|
|
|
@@ -39,10 +48,7 @@ export default class AuthenticationService {
|
|
|
39
48
|
url: url,
|
|
40
49
|
method: APIMethod.POST,
|
|
41
50
|
appType: appType,
|
|
42
|
-
body: JSON.stringify(
|
|
43
|
-
email : email,
|
|
44
|
-
password: password
|
|
45
|
-
})
|
|
51
|
+
body: JSON.stringify(req)
|
|
46
52
|
});
|
|
47
53
|
|
|
48
54
|
if(tokenResponse.success){
|