diff --git a/server/src/main.rs b/server/src/main.rs index 6a33e85..f732a99 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -108,7 +108,7 @@ async fn rocket() -> _ { api::library::move_file, api::library::upload_file, api::library::download_file, api::library::list_files, api::library::get_file, api::library::delete_file, ]) .mount("/auth", routes![ - ui::auth::login + ui::auth::login, ui::auth::login_handler, ui::auth::register, ui::auth::register_handler, ]) .mount("/", routes![ ui::help::about, diff --git a/server/src/routes/ui/auth.rs b/server/src/routes/ui/auth.rs index be532b5..698e0d3 100644 --- a/server/src/routes/ui/auth.rs +++ b/server/src/routes/ui/auth.rs @@ -6,8 +6,21 @@ pub async fn login(route: &Route) -> Template { Template::render("auth/login", context! { route: route.uri.path() }) } + #[post("/login")] pub async fn login_handler(route: &Route) -> Template { Template::render("auth/login", context! { route: route.uri.path() }) +} + +#[get("/register")] +pub async fn register(route: &Route) -> Template { + Template::render("auth/register", context! { route: route.uri.path() }) + +} + +#[post("/register")] +pub async fn register_handler(route: &Route) -> Template { + Template::render("auth/register", context! { route: route.uri.path() }) + } \ No newline at end of file diff --git a/server/templates/about.html.hbs b/server/templates/about.html.hbs index 73aef2e..86f95a9 100644 --- a/server/templates/about.html.hbs +++ b/server/templates/about.html.hbs @@ -4,6 +4,7 @@ diff --git a/server/templates/auth/login.html.hbs b/server/templates/auth/login.html.hbs index b2f9f39..a1fdbff 100644 --- a/server/templates/auth/login.html.hbs +++ b/server/templates/auth/login.html.hbs @@ -18,7 +18,7 @@
- + @@ -42,7 +42,11 @@

- Forgot password? + + {{#if can_register}} + Register + | {{/if}}Forgot password? +
diff --git a/server/templates/auth/register.html.hbs b/server/templates/auth/register.html.hbs new file mode 100644 index 0000000..e2c5292 --- /dev/null +++ b/server/templates/auth/register.html.hbs @@ -0,0 +1,75 @@ +{{#> layouts/default body-class="has-background-white-ter login-bg" }} +

+
+

storage-app

+
+

Register

+ {{#if can_register }} +
+
+ +
+ + + + +
+ {{!--

This username is available

--}} +
+
+ +
+ + + + +
+ {{!--

This username is available

--}} +
+
+ +
+ + + + +
+ {{!--

This username is available

--}} +
+
+ +
+ + + + +
+ {{!--

This username is available

--}} +
+
+
+ +
+
+ {{else}} +
+

Registeration has been disabled

+ + {{!--

Contact administrator

--}} +
+ {{/if}} + + Login + +
+
+
+ +
+
+
+
+
+{{/layouts/default}} \ No newline at end of file