mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-27 08:14:30 -04: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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,3 +233,6 @@ export interface UserIn {
|
||||
export interface ValidateResetToken {
|
||||
token: string;
|
||||
}
|
||||
export interface PasswordResetToken {
|
||||
token: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user