login test gpt chat ai helped (did everyhtging t)

This commit is contained in:
Richard Mikloš 2024-01-19 12:16:20 +01:00
parent 13686d85dc
commit d22a55d52c
2 changed files with 44 additions and 7 deletions

29
assets/login-script.js Normal file

@ -0,0 +1,29 @@
function login() {
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
// Assuming you use fetch API to send data to the server
fetch('https://home.adlerka.top/account', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'login',
email: email,
password: password
}),
})
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
document.getElementById("statusMessage").innerText = "Login successful!";
// Redirect or perform other actions after successful login
} else {
document.getElementById("statusMessage").innerText = "Login failed. Please check your credentials.";
}
})
.catch((error) => {
console.error('Error:', error);
});
}

@ -1,7 +1,15 @@
<form method="post"> <div class="login-container">
<label for="login_email"><i class="fa-regular fa-envelope"></i> Email:</label><br> <h1>Login</h1>
<input id="login_email" type="email" name="email"><br> <form id="loginForm">
<label for="login_password"><i class="ri-lock-fill"></i> Password:</label><br> <label for="email">Email:</label>
<input id="login_password" type="password" name="password"><br> <input type="email" id="email" name="email" required>
<input type="submit">
</form> <label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="button" onclick="login()">Login</button>
</form>
<p id="statusMessage"></p>
</div>
<script src="assets/login-script.js"></script>