mirror of
https://github.com/Jackzmc/storage.git
synced 2025-05-09 00:43:20 +00:00
Add register page
This commit is contained in:
parent
8b401b6bc6
commit
1c561e58f7
5 changed files with 96 additions and 3 deletions
|
@ -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,
|
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![
|
.mount("/auth", routes![
|
||||||
ui::auth::login
|
ui::auth::login, ui::auth::login_handler, ui::auth::register, ui::auth::register_handler,
|
||||||
])
|
])
|
||||||
.mount("/", routes![
|
.mount("/", routes![
|
||||||
ui::help::about,
|
ui::help::about,
|
||||||
|
|
|
@ -6,8 +6,21 @@ pub async fn login(route: &Route) -> Template {
|
||||||
Template::render("auth/login", context! { route: route.uri.path() })
|
Template::render("auth/login", context! { route: route.uri.path() })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/login")]
|
#[post("/login")]
|
||||||
pub async fn login_handler(route: &Route) -> Template {
|
pub async fn login_handler(route: &Route) -> Template {
|
||||||
Template::render("auth/login", context! { route: route.uri.path() })
|
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() })
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://www.flaticon.com/free-icons/default" title="default icons">Default icons created by kliwir art -
|
<li><a href="https://www.flaticon.com/free-icons/default" title="default icons">Default icons created by kliwir art -
|
||||||
Flaticon</a></li>
|
Flaticon</a></li>
|
||||||
|
<li><a href="https://webgradients.com/">https://webgradients.com/</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Password</label>
|
<label class="label">Password</label>
|
||||||
<div class="control has-icons-left">
|
<div class="control has-icons-left">
|
||||||
<input required name="password" class="input" type="text" placeholder="hunter2">
|
<input required name="password" class="input" type="password" placeholder="hunter2">
|
||||||
<span class="icon is-small is-left">
|
<span class="icon is-small is-left">
|
||||||
<i class="fas fa-key"></i>
|
<i class="fas fa-key"></i>
|
||||||
</span>
|
</span>
|
||||||
|
@ -42,7 +42,11 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
<a href="/auth/forgot-password">Forgot password?</a>
|
<span>
|
||||||
|
{{#if can_register}}
|
||||||
|
<a href="/auth/register">Register</a>
|
||||||
|
| {{/if}}<a href="/auth/forgot-password">Forgot password?</a>
|
||||||
|
</span>
|
||||||
<div class="field is-pulled-right">
|
<div class="field is-pulled-right">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<div class="select is-small">
|
<div class="select is-small">
|
||||||
|
|
75
server/templates/auth/register.html.hbs
Normal file
75
server/templates/auth/register.html.hbs
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
{{#> layouts/default body-class="has-background-white-ter login-bg" }}
|
||||||
|
<br><br>
|
||||||
|
<div class="container py-6" style="width:20%"> <!-- TODO: fix width on mobile -->
|
||||||
|
<h1 class="title is-1 has-text-centered">storage-app</h1>
|
||||||
|
<div class="box is-radiusless">
|
||||||
|
<h4 class="title is-4 has-text-centered">Register</h4>
|
||||||
|
{{#if can_register }}
|
||||||
|
<form method="post" action="/auth/register">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Username</label>
|
||||||
|
<div class="control has-icons-left">
|
||||||
|
<input required name="username" class="input" type="text" placeholder="Username">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-user"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{!-- <p class="help is-success">This username is available</p> --}}
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Email</label>
|
||||||
|
<div class="control has-icons-left">
|
||||||
|
<input required name="username" class="input" type="email" placeholder="Email">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-email"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{!-- <p class="help is-success">This username is available</p> --}}
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Password</label>
|
||||||
|
<div class="control has-icons-left">
|
||||||
|
<input required name="password" class="input" type="password" placeholder="hunter2">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-key"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{!-- <p class="help is-success">This username is available</p> --}}
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Password (confirm)</label>
|
||||||
|
<div class="control has-icons-left">
|
||||||
|
<input required name="password" class="input" type="password" placeholder="hunter2">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-key"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{!-- <p class="help is-success">This username is available</p> --}}
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="buttons">
|
||||||
|
<button class="button is-link is-fullwidth" type="submit" >Register</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{{else}}
|
||||||
|
<div class="block ml-2 content">
|
||||||
|
<p><i class="fas fa-xmark"></i>Registeration has been disabled</p>
|
||||||
|
|
||||||
|
{{!-- <p>Contact administrator</p> --}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
<span>
|
||||||
|
<a href="/auth/login">Login</a>
|
||||||
|
</span>
|
||||||
|
<div class="field is-pulled-right">
|
||||||
|
<div class="control">
|
||||||
|
<div class="select is-small">
|
||||||
|
<select>
|
||||||
|
<option selected value="en-us">English</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/layouts/default}}
|
Loading…
Add table
Add a link
Reference in a new issue