<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" type="image/x-icon" href="{% static 'favicon.ico' %}">
<title>Giriş Sayfası</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
}
body {
background: url('/home/n/Desktop/3.jpg') no-repeat center center fixed;
background-size: cover;
}
.container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.form {
background-color: #ffffffe1;
padding: 40px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
width: 400px;
}
.form-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.form-group input {
width: 100%;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form-group .password-group {
position: relative;
}
.form-group .password-group input {
width: calc(100% - 30px);
}
.form-group .password-group .password-toggle {
cursor: pointer;
position: absolute;
top: 10px;
right: 10px;
}
.form-group input[type="submit"] {
background-color: #333;
color: #fff;
cursor: pointer;
}
.form-group input[type="submit"]:hover {
background-color: #555;
}
.form-group .form-text {
font-size: 14px;
color: #888;
margin-top: 5px;
}
</style>
</head>
<body>
<div class="container">
<form class="form" action="{% url 'login' %}" method="POST" onsubmit="return validateForm()">
{% csrf_token %}
<h2 class="form-title">Kullanıcı Girişi</h2>
<div class="form-group">
<label for="username">Kullanıcı Adı veya E-posta:</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Şifre:</label>
<div class="password-group">
<input type="password" id="password" name="password" required>
<span class="password-toggle" onclick="togglePasswordVisibility()">🙈</span>
</div>
</div>
<div class="form-group">
<input type="submit" value="Giriş Yap">
<p class="form-text">Hesabınız yok mu? <a href="{% url 'register' %}">Kaydol</a></p>
</div>
</form>
</div>
<script>
function togglePasswordVisibility() {
var passwordField = document.getElementById('password');
if (passwordField.type === 'password') {
passwordField.type = 'text';
} else {
passwordField.type = 'password';
}
}
function validateForm() {
var usernameField = document.getElementById('username');
var passwordField = document.getElementById('password');
if (usernameField.value.trim() === '' || passwordField.value.trim() === '') {
alert('Kullanıcı adı ve şifre boş olamaz.');
return false;
}
if (passwordField.value.trim().length < 6) {
alert('Şifre en az 6 karakter olmalıdır.');
return false;
}
return true;
}
</script>
</body>
</html>