From b1ff4a62c8a39dad79d91e73eb39a1f9ee37c07a Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Mon, 3 Mar 2025 21:11:48 +0100 Subject: [PATCH] Add link to password reset --- src/back/routes/admin.page.tsx | 8 +++++++- src/back/routes/admin/password.form.ts | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/back/routes/admin.page.tsx b/src/back/routes/admin.page.tsx index c328c9c..3fb627d 100644 --- a/src/back/routes/admin.page.tsx +++ b/src/back/routes/admin.page.tsx @@ -3,7 +3,12 @@ import { TempstreamJSX } from "tempstream"; import { Page } from "@sealcode/sealgen"; import html from "src/back/html.js"; import { button } from "../elements/button.js"; -import { LoginURL, NavbarLinksCRUDListURL, PagesCRUDListURL } from "./urls.js"; +import { + LoginURL, + NavbarLinksCRUDListURL, + PagesCRUDListURL, + ResetPasswordURL, +} from "./urls.js"; export const actionName = "Admin"; @@ -28,6 +33,7 @@ export default new (class AdminPage extends Page { {[ { text: "Edit Pages", href: PagesCRUDListURL }, { text: "Edit Navbar", href: NavbarLinksCRUDListURL }, + { text: "Change Password", href: ResetPasswordURL }, ].map((e) => button({ ...e, variant: "accent1" }))} ), diff --git a/src/back/routes/admin/password.form.ts b/src/back/routes/admin/password.form.ts index d6a7757..aaa6dbd 100644 --- a/src/back/routes/admin/password.form.ts +++ b/src/back/routes/admin/password.form.ts @@ -4,6 +4,7 @@ import { Form, Controls, fieldsToShape } from "@sealcode/sealgen"; import html from "../../html.js"; import { Fields } from "@sealcode/sealgen"; +import { AdminURL } from "../urls.js"; export const actionName = "ResetPassword"; @@ -18,6 +19,7 @@ export default new (class ResetPasswordForm extends Form { fields = fields; controls = [ + new Controls.HTML("decoration", /* HTML */ `

Change password

`), new Controls.SimpleInput(fields.password, { label: "Password:", type: "password", @@ -39,7 +41,7 @@ export default new (class ResetPasswordForm extends Form { async onSuccess() { return { action: "stay", - content: "Password changed", + content: `Password changed
Return to admin panel`, messages: [], }; }