From e529188d915ed642878e6f2b0501022f521af834 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 11 May 2024 14:10:49 -0400 Subject: [PATCH] Add non-functional login/register pages --- src/bin/kawari-web.rs | 22 ++++++++++++++++++++++ src/lib.rs | 2 ++ templates/admin.html | 6 +++++- templates/login.html | 18 ++++++++++++++++++ templates/register.html | 18 ++++++++++++++++++ templates/web.html | 3 +++ 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 templates/login.html create mode 100644 templates/register.html diff --git a/src/bin/kawari-web.rs b/src/bin/kawari-web.rs index e4d308f..4cbbea2f 100644 --- a/src/bin/kawari-web.rs +++ b/src/bin/kawari-web.rs @@ -27,6 +27,26 @@ async fn root() -> Html { Html(template.render(context! { gate_open => config.gate_open }).unwrap()) } +async fn login() -> Html { + tracing::info!("Requesting gate status..."); + + let config = get_config(); + + let environment = setup_default_environment(); + let template = environment.get_template("login.html").unwrap(); + Html(template.render(context! { gate_open => config.gate_open }).unwrap()) +} + +async fn register() -> Html { + tracing::info!("Requesting gate status..."); + + let config = get_config(); + + let environment = setup_default_environment(); + let template = environment.get_template("register.html").unwrap(); + Html(template.render(context! { gate_open => config.gate_open }).unwrap()) +} + #[derive(Deserialize, Debug)] #[allow(dead_code)] struct Input { @@ -59,6 +79,8 @@ async fn main() { let app = Router::new() .route("/", get(root)) + .route("/login", get(login)) + .route("/register", get(register)) .route("/apply", post(apply)); let addr = SocketAddr::from(([127, 0, 0, 1], 5801)); diff --git a/src/lib.rs b/src/lib.rs index 32ebb2b..f1658b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,8 @@ pub fn setup_default_environment() -> Environment<'static> { let mut env = Environment::new(); env.add_template("admin.html", include_str!("../templates/admin.html")).unwrap(); env.add_template("web.html", include_str!("../templates/web.html")).unwrap(); + env.add_template("login.html", include_str!("../templates/login.html")).unwrap(); + env.add_template("register.html", include_str!("../templates/register.html")).unwrap(); env } \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 91b43f7..e074d5a 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -1 +1,5 @@ -

Gate open:{{ gate_open }}

\ No newline at end of file +

Gate open:{{ gate_open }}

+
+ + +
\ No newline at end of file diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..c99be96 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,18 @@ + + + + + Login + + + +
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/templates/register.html b/templates/register.html new file mode 100644 index 0000000..9212053 --- /dev/null +++ b/templates/register.html @@ -0,0 +1,18 @@ + + + + + Register + + + +
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/templates/web.html b/templates/web.html index 173b2e4..85f27a4 100644 --- a/templates/web.html +++ b/templates/web.html @@ -8,5 +8,8 @@

Welcome to Final Fantasy XIV!

+Login +Signup + \ No newline at end of file