From a1539d19313e9d87ce0dd058f99b96a40b297389 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 5 Apr 2025 22:54:48 -0400 Subject: [PATCH] Add stubs for changing password and canceling account pages --- src/bin/kawari-login.rs | 19 +++++++++++++++++++ templates/account.html | 2 ++ templates/changepassword.html | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 templates/changepassword.html diff --git a/src/bin/kawari-login.rs b/src/bin/kawari-login.rs index faa36aa..bd49930 100644 --- a/src/bin/kawari-login.rs +++ b/src/bin/kawari-login.rs @@ -22,6 +22,11 @@ fn setup_default_environment() -> Environment<'static> { .unwrap(); env.add_template("account.html", include_str!("../../templates/account.html")) .unwrap(); + env.add_template( + "changepassword.html", + include_str!("../../templates/changepassword.html"), + ) + .unwrap(); env } @@ -193,6 +198,18 @@ async fn logout(State(state): State, jar: CookieJar) -> (Cooki ) } +async fn change_password() -> Html { + // TODO: actually change password + let environment = setup_default_environment(); + let template = environment.get_template("changepassword.html").unwrap(); + Html(template.render(context! {}).unwrap()) +} + +async fn cancel_account(jar: CookieJar) -> (CookieJar, Redirect) { + // TODO: actually delete account + (jar.remove("cis_sessid"), Redirect::to("/")) +} + #[tokio::main] async fn main() { tracing_subscriber::fmt::init(); @@ -215,6 +232,8 @@ async fn main() { .route("/oauth/oa/registlist", post(do_register)) .route("/account/app/svc/manage", get(account)) .route("/account/app/svc/logout", get(logout)) + .route("/account/app/svc/mbrPasswd", get(change_password)) + .route("/account/app/svc/mbrCancel", get(cancel_account)) .with_state(state); let config = get_config(); diff --git a/templates/account.html b/templates/account.html index 17a5ef5..bb11d59 100644 --- a/templates/account.html +++ b/templates/account.html @@ -1,2 +1,4 @@

Managing account {{ username }}

Logout +Change Password +Cancel Account diff --git a/templates/changepassword.html b/templates/changepassword.html new file mode 100644 index 0000000..ea2ddf9 --- /dev/null +++ b/templates/changepassword.html @@ -0,0 +1,18 @@ + + + + + Kawari - Change Password + + + +
+
+
+
+
+ +
+ + +