-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathlogin.html
More file actions
249 lines (221 loc) · 11.1 KB
/
login.html
File metadata and controls
249 lines (221 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="SB Admin 2 - Login Portal">
<meta name="author" content="">
<title>SB Admin 2 - Login</title>
<!-- Custom fonts for this template-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin-2.min.css" rel="stylesheet">
<!-- Additional custom styles -->
<style>
.bg-gradient-custom {
background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
}
.card-custom {
border-radius: 1rem;
}
.remember-me-text {
color: #858796;
}
.login-heading {
font-weight: 700;
}
.social-btn {
transition: all 0.3s;
}
.social-btn:hover {
transform: translateY(-2px);
}
.login-divider {
position: relative;
text-align: center;
margin: 1.5rem 0;
}
.login-divider:before {
content: "";
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 1px;
background-color: #eaecf4;
}
.login-divider-text {
position: relative;
display: inline-block;
padding: 0 1rem;
background-color: #fff;
font-size: 0.85rem;
color: #858796;
}
.brand-logo {
width: 80px;
height: auto;
margin-bottom: 1.5rem;
}
</style>
</head>
<body class="bg-gradient-custom">
<div class="container">
<!-- Outer Row -->
<div class="row justify-content-center">
<div class="col-xl-10 col-lg-12 col-md-9">
<div class="card o-hidden border-0 shadow-lg my-5 card-custom">
<div class="card-body p-0">
<!-- Nested Row within Card Body -->
<div class="row">
<div class="col-lg-6 d-none d-lg-block">
<div class="d-flex align-items-center justify-content-center h-100 bg-login-image">
<!-- Optional: Add an overlay with text -->
<div class="text-center p-5 text-white">
<h2 class="mb-4">Welcome Back!</h2>
<p class="mb-0">Access your dashboard and manage your business.</p>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<!-- Optional: Add a logo -->
<img class="brand-logo" src="img/logo.png" alt="Company Logo">
<h1 class="h4 text-gray-900 mb-4 login-heading">Welcome Back!</h1>
</div>
<!-- Social Login -->
<div class="mb-3">
<button class="btn btn-google btn-user btn-block social-btn mb-2">
<i class="fab fa-google fa-fw"></i> Sign in with Google
</button>
<button class="btn btn-facebook btn-user btn-block social-btn">
<i class="fab fa-facebook-f fa-fw"></i> Sign in with Facebook
</button>
</div>
<div class="login-divider">
<span class="login-divider-text">OR</span>
</div>
<form class="user" id="loginForm" method="POST" action="process-login.php">
<!-- Security token -->
<input type="hidden" name="security_token" value="<?php echo generateToken(); ?>">
<div class="form-group">
<input type="email" class="form-control form-control-user"
id="emailInput" name="email" aria-describedby="emailHelp"
placeholder="Enter Email Address..." required autocomplete="email">
<div class="invalid-feedback">Please enter a valid email address</div>
</div>
<div class="form-group">
<div class="input-group">
<input type="password" class="form-control form-control-user"
id="passwordInput" name="password" placeholder="Password" required
autocomplete="current-password">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="togglePassword">
<i class="fas fa-eye" id="toggleIcon"></i>
</button>
</div>
</div>
<div class="invalid-feedback">Please enter your password</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox small">
<input type="checkbox" class="custom-control-input" id="rememberCheck" name="remember">
<label class="custom-control-label remember-me-text" for="rememberCheck">Remember
Me</label>
</div>
</div>
<!-- Error message area -->
<div class="alert alert-danger d-none" id="loginError" role="alert"></div>
<button type="submit" class="btn btn-primary btn-user btn-block">
Login
</button>
</form>
<hr>
<div class="text-center">
<a class="small" href="forgot-password.html">Forgot Password?</a>
</div>
<div class="text-center">
<a class="small" href="register.html">Create an Account!</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="js/sb-admin-2.min.js"></script>
<!-- Form validation script -->
<script>
$(document).ready(function() {
// Toggle password visibility
$('#togglePassword').click(function() {
const passwordInput = $('#passwordInput');
const toggleIcon = $('#toggleIcon');
if (passwordInput.attr('type') === 'password') {
passwordInput.attr('type', 'text');
toggleIcon.removeClass('fa-eye').addClass('fa-eye-slash');
} else {
passwordInput.attr('type', 'password');
toggleIcon.removeClass('fa-eye-slash').addClass('fa-eye');
}
});
// Form validation and submission
$('#loginForm').on('submit', function(e) {
e.preventDefault();
let isValid = true;
// Validate email
const email = $('#emailInput').val().trim();
if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
$('#emailInput').addClass('is-invalid');
isValid = false;
} else {
$('#emailInput').removeClass('is-invalid');
}
// Validate password
const password = $('#passwordInput').val();
if (!password) {
$('#passwordInput').addClass('is-invalid');
isValid = false;
} else {
$('#passwordInput').removeClass('is-invalid');
}
if (isValid) {
// Show loading state
const submitBtn = $(this).find('button[type="submit"]');
const originalText = submitBtn.text();
submitBtn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Logging in...');
// Submit form via AJAX
$.ajax({
type: 'POST',
url: $(this).attr('action'),
data: $(this).serialize(),
success: function(response) {
// Redirect on successful login
window.location.href = 'index.html';
},
error: function(xhr) {
// Show error message
$('#loginError').removeClass('d-none').text(xhr.responseJSON?.message || 'Invalid email or password. Please try again.');
// Reset button state
submitBtn.prop('disabled', false).text(originalText);
}
});
}
});
});
</script>
</body>
</html>