Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions assets/css/style1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
body {
font-family: 'Forum', cursive;
background-color: #0E0D0C;
color: #ffffff;
justify-content: center;
align-items: center;
height: 100vh;
display: grid;
}
h2 {
color: hsl(38, 61%, 73%);
font-family: 'Forum', cursive;
font-weight: 400;
line-height: 1.2em;
}
form {
background-color: #2e2925;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 300px;
display: flex;
flex-direction: column;
}

label, input {
margin-bottom: 10px;
color: black;
}
.btn {
width: 100%;
padding: 14px;
background-color: hsl(38, 67%, 67%);
color: hsla(30, 8%, 5%, 1);
font-size: 16px;
border: hsl(38, 61%, 73%);
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
&:hover{
background-color: hsl(38, 60%, 63%);
}
}

input {
padding: 8px;
border-radius: 4px;
border: 1px solid #ccc;
}



button:hover {
background-color: #218838;
}

.msg {
position: fixed;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
background-color: green;
color: white;
padding: 10px 20px;
border-radius: 4px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<span class="span">Contact</span>
</a>
</li>

<li><a href="login.html" class="navbar-link hover-underline">Login</a></li>
</ul>

<div class="text-center">
Expand Down
21 changes: 21 additions & 0 deletions login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Here</title>
<link rel="stylesheet" href="./assets/css/style1.css">
</head>
<body>
<form id="login-form">
<h2>Login</h2>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="submit" class="btn">Submit</button>
</form>

<script src="scripts1.js"></script>
</body>
</html>
35 changes: 35 additions & 0 deletions scripts1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
document.getElementById('login-form').addEventListener('submit', function(event) {
event.preventDefault();

const email = document.getElementById('email').value;
const password = document.getElementById('password').value;

// Email validator
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!emailPattern.test(email)) {
showmsg('Please enter a valid email address');
return;
}

// pass validator
const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#])[A-Za-z\d@$!%*?&#]{8,}$/;
if (!passwordPattern.test(password)) {
showmsg('Password too weak! It should be at least 8 characters long, include an uppercase letter, a number, and a special character.');
return;
}


showmsg('Login successful!');
});


function showmsg(message) {
const msg = document.createElement('div');
msg.className = 'msg';
msg.innerText = message;
document.body.appendChild(msg);

setTimeout(() => {
msg.remove();
}, 3000);
}