Skip to content

Commit 65e7bde

Browse files
committed
Issue#83]
1 parent 3377d52 commit 65e7bde

File tree

5 files changed

+125
-0
lines changed

5 files changed

+125
-0
lines changed

assets/css/style1.css

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
background-color: #2e2d2d;
4+
display: grid;
5+
justify-content: center;
6+
align-items: center;
7+
height: 100vh;
8+
}
9+
10+
form {
11+
background-color: #fff;
12+
padding: 20px;
13+
border-radius: 8px;
14+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
15+
width: 300px;
16+
display: flex;
17+
flex-direction: column;
18+
}
19+
20+
label, input {
21+
margin-bottom: 10px;
22+
}
23+
.btn {
24+
position: relative;
25+
color: var(--gold-crayola);
26+
font-size: var(--fontSize-label-2);
27+
font-weight: var(--weight-bold);
28+
text-transform: uppercase;
29+
letter-spacing: var(--letterSpacing-5);
30+
max-width: max-content;
31+
border: 2px solid var(--gold-crayola);
32+
padding: 12px 45px;
33+
overflow: hidden;
34+
z-index: 1;
35+
}
36+
37+
input {
38+
padding: 8px;
39+
border-radius: 4px;
40+
border: 1px solid #ccc;
41+
}
42+
43+
button {
44+
padding: 10px;
45+
background-color: #28a745;
46+
color: white;
47+
border: none;
48+
border-radius: 4px;
49+
cursor: pointer;
50+
}
51+
52+
button:hover {
53+
background-color: #218838;
54+
}
55+
56+
.msg {
57+
position: fixed;
58+
bottom: 10px;
59+
left: 50%;
60+
transform: translateX(-50%);
61+
background-color: green;
62+
color: white;
63+
padding: 10px 20px;
64+
border-radius: 4px;
65+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
66+
}
67+

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
<span class="span">Contact</span>
168168
</a>
169169
</li>
170+
<li><a href="login.html" class="navbar-link hover-underline">Login</a></li>
170171

171172
</ul>
172173

login.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Login Here</title>
7+
<link rel="stylesheet" href="./assets/css/style1.css">
8+
</head>
9+
<body>
10+
<form id="login-form">
11+
<h2>Login</h2>
12+
<label for="email">Email:</label>
13+
<input type="email" id="email" name="email" required>
14+
<label for="password">Password:</label>
15+
<input type="password" id="password" name="password" required>
16+
<button type="submit" class="btn">Submit</button>
17+
</form>
18+
19+
<script src="scripts1.js"></script>
20+
</body>
21+
</html>

scripts.js

Whitespace-only changes.

scripts1.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
document.getElementById('login-form').addEventListener('submit', function(event) {
2+
event.preventDefault();
3+
4+
const email = document.getElementById('email').value;
5+
const password = document.getElementById('password').value;
6+
7+
// Email validator
8+
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
9+
if (!emailPattern.test(email)) {
10+
showmsg('Please enter a valid email address');
11+
return;
12+
}
13+
14+
// pass validator
15+
const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#])[A-Za-z\d@$!%*?&#]{8,}$/;
16+
if (!passwordPattern.test(password)) {
17+
showmsg('Password too weak! It should be at least 8 characters long, include an uppercase letter, a number, and a special character.');
18+
return;
19+
}
20+
21+
22+
showmsg('Login successful!');
23+
});
24+
25+
26+
function showmsg(message) {
27+
const msg = document.createElement('div');
28+
msg.className = 'msg';
29+
msg.innerText = message;
30+
document.body.appendChild(msg);
31+
32+
setTimeout(() => {
33+
msg.remove();
34+
}, 3000);
35+
}
36+

0 commit comments

Comments
 (0)