Skip to content

Commit a18a906

Browse files
committed
Add Login.html and Welcome.html with login form and success message functionality
1 parent 00d8d25 commit a18a906

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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>Document</title>
7+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous">
8+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js" integrity="sha384-j1CDi7MgGQ12Z7Qab0qlWQ/Qqz24Gc6BM0thvEMVjHnfYGF0rmFCozFSxQBxwHKO" crossorigin="anonymous"></script>
9+
10+
<script src="login.js"></script>
11+
12+
</head>
13+
<body>
14+
15+
<div class="container">
16+
<div class="row justify-content-center">
17+
<div class="col-sm-6">
18+
<div class="card mt-5">
19+
<div class="card-body">
20+
<h5 class="card-title">Login</h5>
21+
<form>
22+
<div class="mb-3">
23+
<label class="form-label">Username</label>
24+
<input type="text" class="form-control" id="username" required>
25+
</div>
26+
<div class="mb-3">
27+
<label class="form-label">Password</label>
28+
<input type="password" class="form-control" id="password" required>
29+
</div>
30+
<button type="submit" class="btn btn-primary" onclick="login_hub()">Login</button>
31+
</form>
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
37+
38+
</body>
39+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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>Document</title>
7+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous">
8+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js" integrity="sha384-j1CDi7MgGQ12Z7Qab0qlWQ/Qqz24Gc6BM0thvEMVjHnfYGF0rmFCozFSxQBxwHKO" crossorigin="anonymous"></script>
9+
</head>
10+
<body>
11+
<h1>Welcome to home page</h1>
12+
<p>Welcome to the home page. You have successfully logged in.</p>
13+
</body>
14+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function login_hub(){
2+
3+
user_name = document.getElementById("username").value;
4+
user_password = document.getElementById("password").value;
5+
6+
user = "admin@cwpc.in";
7+
password = "admin@123";
8+
9+
if(user_name == user && user_password == password){
10+
alert("Login Successful");
11+
window.open("Welcome.html");
12+
}else{
13+
alert("Login Failed");
14+
document.getElementById("username").value = "";
15+
document.getElementById("password").value = "";
16+
}
17+
18+
19+
20+
}

0 commit comments

Comments
 (0)