blob: 8ba8cd1e92f7bcfa0f54468b671ce57be8475f56 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import { hash } from '../helpers/password-helpers';
export default class UserApi {
constructor(server, local) {
this.server = server;
this.local = local;
}
login(email, password) {
return this.server.login(email, hash(password));
}
logout() {
return this;
}
signup(data) {
Object.assign(data, {
password: hash(data.password),
});
return this.server.signup(data);
}
password(email) {
return this.server.retrievePassword(email);
}
activateTrial(data) {
return this.server.activateTrial(data);
}
invite(data) {
return this.server.inviteUser(data);
}
getInfo() {
return this.server.userInfo();
}
updateInfo(data) {
const userData = data;
if (userData.oldPassword && userData.newPassword) {
userData.oldPassword = hash(userData.oldPassword);
userData.newPassword = hash(userData.newPassword);
}
return this.server.updateUserInfo(userData);
}
getLegacyServices() {
return this.server.getLegacyServices();
}
delete() {
return this.server.deleteAccount();
}
}
|