attlaz-client 1.9.43 → 1.9.45
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.
|
@@ -20,7 +20,7 @@ export declare class UserEndpoint extends Endpoint {
|
|
|
20
20
|
allowed: boolean;
|
|
21
21
|
}>>;
|
|
22
22
|
update(user: User): Promise<User>;
|
|
23
|
-
create(user: User, invitationCode?: string | null): Promise<User>;
|
|
23
|
+
create(user: User, password: string, invitationCode?: string | null): Promise<User>;
|
|
24
24
|
requestResetPassword(email: string): Promise<boolean>;
|
|
25
25
|
resetPassword(code: string, password: string): Promise<boolean>;
|
|
26
26
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserEndpoint = void 0;
|
|
4
4
|
const UserAuthProvider_1 = require("../Model/User/UserAuthProvider");
|
|
5
|
+
const OAuthClientToken_1 = require("../Http/OAuthClientToken");
|
|
5
6
|
const Endpoint_1 = require("./Endpoint");
|
|
6
7
|
const User_1 = require("../Model/User");
|
|
7
8
|
const Utils_1 = require("../Utils");
|
|
@@ -14,8 +15,11 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
14
15
|
async authenticateByAuthProvider(providerType, data) {
|
|
15
16
|
try {
|
|
16
17
|
const parser = (raw) => {
|
|
17
|
-
|
|
18
|
-
const
|
|
18
|
+
const access_token = raw.access_token;
|
|
19
|
+
const token_type = raw.token_type;
|
|
20
|
+
const refresh_token = raw.refresh_token;
|
|
21
|
+
const scope = raw.scope;
|
|
22
|
+
const token = new OAuthClientToken_1.OAuthClientToken(access_token, token_type, refresh_token, scope);
|
|
19
23
|
token.expires = Utils_1.Utils.parseRawDate(raw.expires);
|
|
20
24
|
return token;
|
|
21
25
|
};
|
|
@@ -86,7 +90,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
86
90
|
async update(user) {
|
|
87
91
|
try {
|
|
88
92
|
let url = '/users/' + user.id;
|
|
89
|
-
const result = await this.requestObject(url,
|
|
93
|
+
const result = await this.requestObject(url, user, User_1.User.parse, 'POST');
|
|
90
94
|
const updatedUser = result.getData();
|
|
91
95
|
if (updatedUser === null) {
|
|
92
96
|
throw new Error('User not updated');
|
|
@@ -100,14 +104,13 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
100
104
|
throw e;
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
|
-
async create(user, invitationCode = null) {
|
|
107
|
+
async create(user, password, invitationCode = null) {
|
|
104
108
|
try {
|
|
105
109
|
let url = '/users/';
|
|
106
|
-
const data =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const result = await this.requestObject(url, data, parser, 'PUT', false);
|
|
110
|
+
const data = user;
|
|
111
|
+
data.password = password;
|
|
112
|
+
data.invitation_code = invitationCode;
|
|
113
|
+
const result = await this.requestObject(url, data, User_1.User.parse, 'PUT', false);
|
|
111
114
|
const createdUser = result.getData();
|
|
112
115
|
if (createdUser === null) {
|
|
113
116
|
throw new Error('User not created');
|