From 97404fff1b3a7eee95b63de0939e2b964482b480 Mon Sep 17 00:00:00 2001 From: Haelnorr Date: Sun, 16 Feb 2025 12:38:07 +1100 Subject: [PATCH] Added change password functionality --- server/routes.go | 6 + view/component/account/changepassword.templ | 141 ++++++++++++++++++ view/component/account/container.templ | 2 +- view/component/account/security.templ | 7 + view/component/form/confirmpass.templ | 7 +- .../popup/confirmPasswordModal.templ | 1 + 6 files changed, 159 insertions(+), 5 deletions(-) create mode 100644 view/component/account/changepassword.templ create mode 100644 view/component/account/security.templ diff --git a/server/routes.go b/server/routes.go index c89272a..606036e 100644 --- a/server/routes.go +++ b/server/routes.go @@ -91,4 +91,10 @@ func addRoutes( middleware.RequiresLogin( handlers.HandleChangeBio(logger, conn), )) + mux.Handle("POST /change-password", + middleware.RequiresLogin( + middleware.RequiresFresh( + handlers.HandleChangePassword(logger, conn), + ), + )) } diff --git a/view/component/account/changepassword.templ b/view/component/account/changepassword.templ new file mode 100644 index 0000000..6c368d3 --- /dev/null +++ b/view/component/account/changepassword.templ @@ -0,0 +1,141 @@ +package account + +templ ChangePassword(err string) { +
+ +
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+
+

+
+} diff --git a/view/component/account/container.templ b/view/component/account/container.templ index f4350d7..f065949 100644 --- a/view/component/account/container.templ +++ b/view/component/account/container.templ @@ -19,7 +19,7 @@ templ AccountContainer(subpage string) { case "General": @AccountGeneral() case "Security": - @AccountGeneral() + @AccountSecurity() } diff --git a/view/component/account/security.templ b/view/component/account/security.templ new file mode 100644 index 0000000..e61ead8 --- /dev/null +++ b/view/component/account/security.templ @@ -0,0 +1,7 @@ +package account + +templ AccountSecurity() { +
+ @ChangePassword("") +
+} diff --git a/view/component/form/confirmpass.templ b/view/component/form/confirmpass.templ index 90bb192..a19e9a6 100644 --- a/view/component/form/confirmpass.templ +++ b/view/component/form/confirmpass.templ @@ -9,11 +9,11 @@ templ ConfirmPassword(err string) { x-on:htmx:xhr:loadstart="submitted=true;buttontext='Loading...'" >