Spaces:
Running
Running
user login optimize
Browse files- user-login.html +54 -21
user-login.html
CHANGED
|
@@ -63,33 +63,66 @@
|
|
| 63 |
<p class="lead">Find skilled workers in your locality or register as a worker to get more opportunities</p>
|
| 64 |
</div>
|
| 65 |
</div>
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
</div>
|
| 74 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" defer crossorigin="anonymous"></script>
|
| 75 |
-
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js" defer crossorigin="anonymous"></script>
|
| 76 |
-
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet" media="print" onload="this.media='all'" crossorigin="anonymous">
|
| 77 |
<script>
|
| 78 |
document.addEventListener('DOMContentLoaded', function() {
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
});
|
| 86 |
|
| 87 |
-
//
|
| 88 |
-
const
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
});
|
| 93 |
});
|
| 94 |
</script>
|
| 95 |
</body>
|
|
|
|
| 63 |
<p class="lead">Find skilled workers in your locality or register as a worker to get more opportunities</p>
|
| 64 |
</div>
|
| 65 |
</div>
|
| 66 |
+
<div class="container my-5">
|
| 67 |
+
<div class="row justify-content-center">
|
| 68 |
+
<div class="col-md-6">
|
| 69 |
+
<div class="card login-card">
|
| 70 |
+
<div class="card-body">
|
| 71 |
+
<h2 class="card-title text-center mb-4">User Login</h2>
|
| 72 |
+
<form id="userLoginForm">
|
| 73 |
+
<div class="mb-3">
|
| 74 |
+
<label for="userMobile" class="form-label">Mobile Number</label>
|
| 75 |
+
<input type="tel" class="form-control" id="userMobile" required pattern="[0-9]{10}" placeholder="Enter 10-digit mobile number">
|
| 76 |
+
</div>
|
| 77 |
+
<div class="mb-3">
|
| 78 |
+
<label for="userPassword" class="form-label">Password</label>
|
| 79 |
+
<input type="password" class="form-control" id="userPassword" required placeholder="Enter your password">
|
| 80 |
+
</div>
|
| 81 |
+
<div class="d-grid gap-2">
|
| 82 |
+
<button type="submit" class="btn btn-primary">Login</button>
|
| 83 |
+
<a href="index.html" class="btn btn-outline-secondary">Back to Home</a>
|
| 84 |
+
</div>
|
| 85 |
+
</form>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
</div>
|
| 91 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" defer crossorigin="anonymous"></script>
|
|
|
|
|
|
|
| 92 |
<script>
|
| 93 |
document.addEventListener('DOMContentLoaded', function() {
|
| 94 |
+
// Handle form submission
|
| 95 |
+
document.getElementById('userLoginForm').addEventListener('submit', function(e) {
|
| 96 |
+
e.preventDefault();
|
| 97 |
+
|
| 98 |
+
const mobile = document.getElementById('userMobile').value;
|
| 99 |
+
const password = document.getElementById('userPassword').value;
|
| 100 |
+
|
| 101 |
+
// Simple validation
|
| 102 |
+
if (mobile.length !== 10 || !/^\d+$/.test(mobile)) {
|
| 103 |
+
alert('Please enter a valid 10-digit mobile number');
|
| 104 |
+
return;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
if (password.length < 6) {
|
| 108 |
+
alert('Password must be at least 6 characters');
|
| 109 |
+
return;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
// Store user data and redirect
|
| 113 |
+
localStorage.setItem('userData', JSON.stringify({
|
| 114 |
+
mobile: mobile,
|
| 115 |
+
loggedIn: true
|
| 116 |
+
}));
|
| 117 |
+
|
| 118 |
+
window.location.href = 'user-dashboard.html';
|
| 119 |
});
|
| 120 |
|
| 121 |
+
// Check if already logged in
|
| 122 |
+
const userData = JSON.parse(localStorage.getItem('userData'));
|
| 123 |
+
if (userData && userData.loggedIn) {
|
| 124 |
+
window.location.href = 'user-dashboard.html';
|
| 125 |
+
}
|
|
|
|
| 126 |
});
|
| 127 |
</script>
|
| 128 |
</body>
|