Comparing version 0.10.0-alpha to 0.10.1-alpha
@@ -9,2 +9,4 @@ import User from "./User"; | ||
_patch(data: APIUserAuthenticatedData): void; | ||
/** Change the current password for this user */ | ||
changePassword(oldPassword: string, newPassword: string): Promise<void>; | ||
/** Return data for api request */ | ||
@@ -11,0 +13,0 @@ toJSON(): { |
@@ -1,2 +0,2 @@ | ||
import { __extends } from "tslib"; | ||
import { __awaiter, __extends, __generator } from "tslib"; | ||
import User from "./User"; | ||
@@ -22,2 +22,16 @@ import UserResourceManager from "../managers/UserResourceManager"; | ||
}; | ||
/** Change the current password for this user */ | ||
UserAuthenticated.prototype.changePassword = function (oldPassword, newPassword) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.rest.putRequest("/users/me/reset_password", { oldPassword: oldPassword, newPassword: newPassword })]; | ||
case 1: | ||
_a.sent(); | ||
this.client.auth.logout(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** Return data for api request */ | ||
@@ -24,0 +38,0 @@ UserAuthenticated.prototype.toJSON = function () { |
@@ -39,2 +39,6 @@ import Client from "./Client"; | ||
refresh(): Promise<LoginResponse>; | ||
/** Start the password reset process by e-mail */ | ||
sendResetPasswordMail(email: string): Promise<void>; | ||
/** Register new password with token received by e-mail */ | ||
resetPassword(token: string, newPassword: string): Promise<void>; | ||
} |
@@ -103,4 +103,31 @@ import { __awaiter, __generator } from "tslib"; | ||
}; | ||
/** Start the password reset process by e-mail */ | ||
Auth.prototype.sendResetPasswordMail = function (email) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.rest.postRequest("/forgot_password", { email: email }, false, 204)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** Register new password with token received by e-mail */ | ||
Auth.prototype.resetPassword = function (token, newPassword) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.rest.postRequest("/forgot_password/".concat(token), { password: newPassword }, false, 204)]; | ||
case 1: | ||
_a.sent(); | ||
this.logout(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return Auth; | ||
}()); | ||
export default Auth; |
{ | ||
"name": "rr-apilib", | ||
"version": "0.10.0-alpha", | ||
"version": "0.10.1-alpha", | ||
"description": "Library for interact with RR-API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
154584
3135