1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-26 07:19:23 +00:00

Can change user password

This commit is contained in:
Pierre HUBERT 2020-03-22 14:26:11 +01:00
parent e06fc281aa
commit ea203e6b3f
2 changed files with 17 additions and 0 deletions

View File

@ -95,6 +95,8 @@ export const Routes : Route[] = [
{path: "/settings/set_security", cb: (h) => SettingsController.SetSecurity(h)}, {path: "/settings/set_security", cb: (h) => SettingsController.SetSecurity(h)},
{path: "/settings/update_password", cb: (h) => SettingsController.UpdatePassword(h)},
// Friends controller // Friends controller
{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)}, {path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},

View File

@ -175,4 +175,19 @@ export class SettingsController {
h.success(); h.success();
} }
/**
* Update user password
*
* @param h Request handler
*/
public static async UpdatePassword(h: RequestHandler) {
await h.needUserPostPassword("oldPassword");
const newPassword = h.postString("newPassword");
await AccountHelper.ChangePassword(h.getUserId(), newPassword);
h.success();
}
} }