mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-26 08:37:44 +00:00
Add non-functional login/register pages
This commit is contained in:
parent
f37840d44f
commit
e529188d91
6 changed files with 68 additions and 1 deletions
|
@ -27,6 +27,26 @@ async fn root() -> Html<String> {
|
|||
Html(template.render(context! { gate_open => config.gate_open }).unwrap())
|
||||
}
|
||||
|
||||
async fn login() -> Html<String> {
|
||||
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<String> {
|
||||
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));
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1 +1,5 @@
|
|||
<p>Gate open:{{ gate_open }}</p><form action='apply' method='post'><input type='checkbox' id='gate_open' name='gate_open' checked /><button type='submit'>Apply</button></form>
|
||||
<p>Gate open:{{ gate_open }}</p>
|
||||
<form action='apply' method='post'>
|
||||
<input type='checkbox' id='gate_open' name='gate_open' checked/>
|
||||
<button type='submit'>Apply</button>
|
||||
</form>
|
18
templates/login.html
Normal file
18
templates/login.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form method='post'>
|
||||
<label for="username">Username:</label><br>
|
||||
<input type='text' id='username' name='username'/><br>
|
||||
<label for="password">Password:</label><br>
|
||||
<input type='text' id='password' name='password'/><br>
|
||||
<button type='submit'>Login</button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
18
templates/register.html
Normal file
18
templates/register.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Register</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form method='post'>
|
||||
<label for="username">Username:</label><br>
|
||||
<input type='text' id='username' name='username'/><br>
|
||||
<label for="password">Password:</label><br>
|
||||
<input type='text' id='password' name='password'/><br>
|
||||
<button type='submit'>Register</button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -8,5 +8,8 @@
|
|||
|
||||
<p>Welcome to Final Fantasy XIV!</p>
|
||||
|
||||
<a href="/login">Login</a>
|
||||
<a href="/register">Signup</a>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue