Skip to content

Instantly share code, notes, and snippets.

@AhmetEnesKCC
Created January 16, 2025 14:06
Show Gist options
  • Save AhmetEnesKCC/a512b058a6e6160350e5e9a62c28cf26 to your computer and use it in GitHub Desktop.
Save AhmetEnesKCC/a512b058a6e6160350e5e9a62c28cf26 to your computer and use it in GitHub Desktop.
if (
document.getElementById("btnSignCommon-1") &&
document.getElementById("btnSignCommon-2")
) {
document
.getElementById("btnSignCommon-1")
.addEventListener("click", function () {
window.location.href = "login.html";
});
document
.getElementById("btnSignCommon-2")
.addEventListener("click", function () {
window.location.href = "login.html";
});
}
console.log(document.getElementById("loginContainer"));
document.getElementById("loginContainer").addEventListener("submit", (e) => {
e.preventDefault(); // burada formun varsayılan davranışını engelliyoruz. sayfayı yenilemesini
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
console.log(email, password);
const validEmail = "[email protected]";
const validPassword = "12345";
if (email === validEmail && password === validPassword) {
alert("giriş başarılı!");
window.location.href = "main.html";
} else {
document.getElementById("message").textContent =
"E-posta veya şifre hatalı!";
}
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"
integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link
href="https://fonts.googleapis.com/css2?family=Delius&family=Manrope:[email protected]&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="style.css" />
<title>proje-101</title>
</head>
<body>
<div class="atom">
<div class="line line-1"></div>
<div class="line line-2"></div>
<div class="line line-3"></div>
</div>
<div class="container-head">
<div class="form-first">
<form>
<div class="container">
<h1>Let's learn math!</h1>
<div class="button-container">
<button
type="button"
class="btn-sign-common"
id="btnSignCommon-1"
onclick="window.location.href='/login.html'"
>
Sign in
</button>
<button
type="button"
class="btn-sign-common"
id="btnSignCommon-2"
onclick="window.location.href='/login.html'"
>
Sign up
</button>
</div>
</div>
</form>
</div>
</div>
<a href="/login.html"></a>
<script src="/app.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link href="https://fonts.googleapis.com/css2?family=Delius&family=Manrope:[email protected]&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/login.css">
<title>Sign in</title>
</head>
<body>
<div class="login-container" >
<div class="form-sign-in" >
<form id="loginContainer">
<h1>Welcome Back :)</h1>
<div class="sign-in">
<input type="email" placeholder="enter your email" id="email" required >
<input type="password" placeholder="enter your password" id="password" required >
<a href="#">Forget Your Password?</a>
<button type="submit">Sign In</button>
<p id="message" style="color: red;"></p>
</div>
</form>
<div class="sign-up">
<p>don't have an account?<button class="modal-trigger">Create Account</button></p>
</div>
</div>
<div class="atom">
<div class="line line-1"></div>
<div class="line line-2"></div>
<div class="line line-3"></div>
</div>
<div class="modal-overlay">
<div class="modal">
<div class="modal-header">
<h2>Please New Account</h2>
<button class="close-button">&times;</button>
</div>
<form id="signup-form">
<div class="form-group">
<label for="name">Full Name</label>
<input type="text" id="name" required>
</div>
<div class="form-group">
<label for="email">E-mail</label>
<input type="email" id="email" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" required>
</div>
<div class="form-group">
<label for="password-confirm">Password Again</label>
<input type="password" id="password-confirm" required>
</div>
<button type="submit" class="submit-button">Sign Up</button>
</form>
</div>
</div>
</div>
<script src="/app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment