Add link to password reset

This commit is contained in:
Kuba Orlik 2025-03-03 21:11:48 +01:00
parent 3eee0c189e
commit b1ff4a62c8
2 changed files with 10 additions and 2 deletions

View File

@ -3,7 +3,12 @@ import { TempstreamJSX } from "tempstream";
import { Page } from "@sealcode/sealgen"; import { Page } from "@sealcode/sealgen";
import html from "src/back/html.js"; import html from "src/back/html.js";
import { button } from "../elements/button.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"; export const actionName = "Admin";
@ -28,6 +33,7 @@ export default new (class AdminPage extends Page {
{[ {[
{ text: "Edit Pages", href: PagesCRUDListURL }, { text: "Edit Pages", href: PagesCRUDListURL },
{ text: "Edit Navbar", href: NavbarLinksCRUDListURL }, { text: "Edit Navbar", href: NavbarLinksCRUDListURL },
{ text: "Change Password", href: ResetPasswordURL },
].map((e) => button({ ...e, variant: "accent1" }))} ].map((e) => button({ ...e, variant: "accent1" }))}
</div> </div>
), ),

View File

@ -4,6 +4,7 @@ import { Form, Controls, fieldsToShape } from "@sealcode/sealgen";
import html from "../../html.js"; import html from "../../html.js";
import { Fields } from "@sealcode/sealgen"; import { Fields } from "@sealcode/sealgen";
import { AdminURL } from "../urls.js";
export const actionName = "ResetPassword"; export const actionName = "ResetPassword";
@ -18,6 +19,7 @@ export default new (class ResetPasswordForm extends Form<typeof fields, void> {
fields = fields; fields = fields;
controls = [ controls = [
new Controls.HTML("decoration", /* HTML */ `<h1>Change password</h1>`),
new Controls.SimpleInput(fields.password, { new Controls.SimpleInput(fields.password, {
label: "Password:", label: "Password:",
type: "password", type: "password",
@ -39,7 +41,7 @@ export default new (class ResetPasswordForm extends Form<typeof fields, void> {
async onSuccess() { async onSuccess() {
return { return {
action: <const>"stay", action: <const>"stay",
content: "Password changed", content: `Password changed <br/><a href="${AdminURL}">Return to admin panel</a>`,
messages: [], messages: [],
}; };
} }