Login page
This commit is contained in:
parent
0245379b90
commit
348d37d26e
@ -155,12 +155,17 @@ async fn delete_user(mut db: Connection<Db>, user_id: &str) -> Status {
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/login")]
|
||||
fn login() -> Template {
|
||||
Template::render("login", context! {})
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build()
|
||||
.mount(
|
||||
"/",
|
||||
routes![index, message, create_user, get_users, delete_user],
|
||||
routes![index, message, create_user, get_users, delete_user, login],
|
||||
)
|
||||
.mount("/static", FileServer::from("static"))
|
||||
.attach(Template::fairing())
|
||||
|
@ -10,11 +10,14 @@ body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
background-color: var(--dark-bg);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
body.with-sidebar {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
background-color: var(--sidebar-bg);
|
||||
@ -62,4 +65,69 @@ body {
|
||||
line-height: 1.6;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
background-color: var(--dark-bg);
|
||||
}
|
||||
|
||||
.login-form {
|
||||
background-color: var(--sidebar-bg);
|
||||
padding: 2rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.login-form h1 {
|
||||
color: var(--primary-red);
|
||||
text-align: center;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--text-muted);
|
||||
border-radius: 4px;
|
||||
background-color: var(--dark-bg);
|
||||
color: var(--text-color);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-red);
|
||||
}
|
||||
|
||||
.login-form button {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
background-color: var(--primary-red);
|
||||
color: var(--text-color);
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.login-form button:hover {
|
||||
opacity: 0.9;
|
||||
}
|
12
templates/base.html.tera
Normal file
12
templates/base.html.tera
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>RSS Reader Login</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
</head>
|
||||
<body class="{% block body_class %}{% endblock %}">
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
@ -1,3 +1,8 @@
|
||||
{% extends "base" %}
|
||||
|
||||
{% block body_class %}with-sidebar{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@ -20,4 +25,5 @@
|
||||
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
{% endblock %}
|
18
templates/login.html.tera
Normal file
18
templates/login.html.tera
Normal file
@ -0,0 +1,18 @@
|
||||
{% extends "base" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="login-container">
|
||||
<form class="login-form">
|
||||
<h1>Login</h1>
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" required>
|
||||
</div>
|
||||
<button type="submit">Log In</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user