mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-08 05:51:50 -07:00
feature: add password reset token endpoint to the admin panel (#2171)
* add password reset token endpoint to the admin panel * add None check on token * add localization message for passowrd reset link button
This commit is contained in:
parent
1b26ca0cb3
commit
93eb2af087
6 changed files with 52 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { UnlockResults, UserIn, UserOut } from "~/lib/api/types/user";
|
||||
import { ForgotPassword, PasswordResetToken, UnlockResults, UserIn, UserOut } from "~/lib/api/types/user";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
@ -7,6 +7,7 @@ const routes = {
|
|||
adminUsers: `${prefix}/admin/users`,
|
||||
adminUsersId: (tag: string) => `${prefix}/admin/users/${tag}`,
|
||||
adminResetLockedUsers: (force: boolean) => `${prefix}/admin/users/unlock?force=${force ? "true" : "false"}`,
|
||||
adminPasswordResetToken: `${prefix}/admin/users/password-reset-token`,
|
||||
};
|
||||
|
||||
export class AdminUsersApi extends BaseCRUDAPI<UserIn, UserOut, UserOut> {
|
||||
|
@ -16,4 +17,8 @@ export class AdminUsersApi extends BaseCRUDAPI<UserIn, UserOut, UserOut> {
|
|||
async unlockAllUsers(force = false) {
|
||||
return await this.requests.post<UnlockResults>(routes.adminResetLockedUsers(force), {});
|
||||
}
|
||||
|
||||
async generatePasswordResetToken(payload: ForgotPassword) {
|
||||
return await this.requests.post<PasswordResetToken>(routes.adminPasswordResetToken, payload);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue