1
Fork 0
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:
Joshua Goins 2024-05-11 14:10:49 -04:00
parent f37840d44f
commit e529188d91
6 changed files with 68 additions and 1 deletions

View file

@ -27,6 +27,26 @@ async fn root() -> Html<String> {
Html(template.render(context! { gate_open => config.gate_open }).unwrap()) 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)] #[derive(Deserialize, Debug)]
#[allow(dead_code)] #[allow(dead_code)]
struct Input { struct Input {
@ -59,6 +79,8 @@ async fn main() {
let app = Router::new() let app = Router::new()
.route("/", get(root)) .route("/", get(root))
.route("/login", get(login))
.route("/register", get(register))
.route("/apply", post(apply)); .route("/apply", post(apply));
let addr = SocketAddr::from(([127, 0, 0, 1], 5801)); let addr = SocketAddr::from(([127, 0, 0, 1], 5801));

View file

@ -17,6 +17,8 @@ pub fn setup_default_environment() -> Environment<'static> {
let mut env = Environment::new(); let mut env = Environment::new();
env.add_template("admin.html", include_str!("../templates/admin.html")).unwrap(); 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("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 env
} }

View file

@ -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
View 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
View 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>

View file

@ -8,5 +8,8 @@
<p>Welcome to Final Fantasy XIV!</p> <p>Welcome to Final Fantasy XIV!</p>
<a href="/login">Login</a>
<a href="/register">Signup</a>
</body> </body>
</html> </html>