mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-12-29 06:58:51 +00:00
Can change user password
This commit is contained in:
parent
e06fc281aa
commit
ea203e6b3f
@ -95,6 +95,8 @@ export const Routes : Route[] = [
|
||||
|
||||
{path: "/settings/set_security", cb: (h) => SettingsController.SetSecurity(h)},
|
||||
|
||||
{path: "/settings/update_password", cb: (h) => SettingsController.UpdatePassword(h)},
|
||||
|
||||
|
||||
// Friends controller
|
||||
{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},
|
||||
|
@ -175,4 +175,19 @@ export class SettingsController {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user