Files
rr3-server/RR3CommunityServer/Pages/Login.cshtml
Daniel Elliott 15e842ce85 Fix CSRF token issue in login and register forms
- Added @Html.AntiForgeryToken() to Register.cshtml
- Added @Html.AntiForgeryToken() to Login.cshtml
- Fixes 400 Bad Request errors on form submission

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-19 16:03:42 -08:00

165 lines
4.0 KiB
Plaintext

@page
@model RR3CommunityServer.Pages.LoginModel
@{
ViewData["Title"] = "Login";
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login - RR3 Community Server</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.login-container {
background: white;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
padding: 40px;
width: 100%;
max-width: 400px;
}
.logo {
text-align: center;
margin-bottom: 30px;
}
.logo h1 {
color: #667eea;
font-size: 28px;
margin-bottom: 5px;
}
.logo p {
color: #666;
font-size: 14px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
color: #333;
font-weight: 500;
margin-bottom: 8px;
}
.form-group input {
width: 100%;
padding: 12px;
border: 2px solid #e0e0e0;
border-radius: 6px;
font-size: 14px;
transition: border-color 0.3s;
}
.form-group input:focus {
outline: none;
border-color: #667eea;
}
.error-message {
background: #fee;
border: 1px solid #fcc;
border-radius: 6px;
padding: 12px;
color: #c33;
margin-bottom: 20px;
font-size: 14px;
}
.btn-login {
width: 100%;
padding: 12px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 6px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.btn-login:hover {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}
.btn-login:active {
transform: translateY(0);
}
.register-link {
text-align: center;
margin-top: 20px;
color: #666;
font-size: 14px;
}
.register-link a {
color: #667eea;
text-decoration: none;
font-weight: 600;
}
.register-link a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="login-container">
<div class="logo">
<h1>🏎️ RR3 Community Server</h1>
<p>Admin Panel Login</p>
</div>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="error-message">
@Model.ErrorMessage
</div>
}
<form method="post">
@Html.AntiForgeryToken()
<div class="form-group">
<label for="Username">Username or Email</label>
<input type="text" id="Username" name="Username" required autofocus />
</div>
<div class="form-group">
<label for="Password">Password</label>
<input type="password" id="Password" name="Password" required />
</div>
<button type="submit" class="btn-login">Login</button>
</form>
<div class="register-link">
Don't have an account? <a asp-page="/Register">Register here</a>
</div>
</div>
</body>
</html>