-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
585 lines (533 loc) · 28.6 KB
/
Copy pathindex.php
File metadata and controls
585 lines (533 loc) · 28.6 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
<?php
/*
| -----------------------------------------------------
| PRODUCT NAME: Sultan POS - Point of Sale with Stock Management System
| -----------------------------------------------------
| AUTHOR: Sultan Zain
| -----------------------------------------------------
| EMAIL: sultan.zain004@outlook.com
| -----------------------------------------------------
| COPYRIGHT: RESERVED BY SULTAN TECHNOLOGIES
| -----------------------------------------------------
| WEBSITE: https://sultans.group/
| -----------------------------------------------------
*/
include("_init.php");
$document->setTitle(trans('text_login_title'));
// Check, If User Login or Not
if ($user->isLogged()) {
redirect(ADMINDIRNAME.'/dashboard.php');
}
function insert_error_log()
{
$statement = db()->prepare("INSERT INTO `login_logs` SET `ip` = ?, `status` = ?");
$statement->execute(array(get_real_ip(), 'error'));
}
if ($request->server['REQUEST_METHOD'] == 'POST' && $request->get['action_type'] == "LOGIN")
{
try {
// Check total try
$from = date('Y-m-d H:i:s', strtotime('-'.(int)UNLOCK_ACCOUNT_AFTER.' minutes', time()));
$to = date('Y-m-d H:i:s');
$ip = get_real_ip();
$statement = db()->prepare("SELECT `id` FROM `login_logs` WHERE `status` = ? AND `ip` = ? AND `created_at` >= ? AND `created_at` <= ?");
$statement->execute(array('error', $ip, $from, $to));
$total_try = $statement->rowCount();
if ($total_try >= (int)TOTAL_LOGIN_TRY) {
throw new Exception($language->get('error_login_attempts_exceeded') . '. Try after' . UNLOCK_ACCOUNT_AFTER . ' munute(s)');
}
// Validate Username
if (!isset($request->post['username']) || !isset($request->post['username'])) {
insert_error_log();
throw new Exception(trans('error_username_or_password'));
}
if (!validateString($request->post['username'])) {
insert_error_log();
throw new Exception(trans('error_username'));
}
// Validate Password
if (empty($request->post['password'])) {
insert_error_log();
throw new Exception(trans('error_password'));
}
$username = $request->post['username'];
$password = $request->post['password'];
// Attempt to Log In
if ($user->login($username, $password)) {
$statement = db()->prepare("INSERT INTO `login_logs` SET `user_id` = ?, `username` = ?, `ip` = ?, `created_at` = ?");
$statement->execute(array(user_id(), $username, get_real_ip(), date_time()));
$statement = db()->prepare("UPDATE `users` SET `last_login` = ? WHERE `id` = ?");
$statement->execute(array(date_time(), user_id()));
$statement = db()->prepare("DELETE FROM `login_logs` WHERE `ip` = ? AND `status` = ?");
$statement->execute(array(get_real_ip(), 'error'));
if (LOG) {
$log_path = DIR_STORAGE . 'logs/v.txt';
write_file($log_path, get_real_ip() . ' | ', 'a');
}
// Remember Me
if(!empty($_POST["remember"])) {
setcookie ("user_login",$_POST["username"],time()+ (10 * 365 * 24 * 60 * 60));
} else {
if(isset($_COOKIE["user_login"])) {
setcookie ("user_login","");
}
}
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(array('msg' => trans('login_success'), 'sessionUserId' => $session->data['id'], 'count_user_store' => count_user_store(), 'store_id' => $user->getSingleStoreId()));
exit();
}
insert_error_log();
throw new Exception(trans('error_invalid_username_password'));
} catch (Exception $e) {
header('HTTP/1.1 422 Unprocessable Entity');
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(array('errorMsg' => $e->getMessage()));
exit();
}
}
// Sending Password Resetting Code Via Email
if ($request->server['REQUEST_METHOD'] == 'POST' && $request->get['action_type'] == "SEND_PASSWORD_RESET_CODE")
{
try {
if(DEMO) {
throw new Exception(trans('error_disable_in_demo'));
}
// Validate Email Address
if (!validateEmail($request->post['email'])) {
throw new Exception(trans('error_email'));
}
$email = $request->post['email'];
// Check, If Email Address Exist In Database or Not
$statement = db()->prepare("SELECT * FROM `users` LEFT JOIN `user_to_store` as `u2s` ON (`users`.`id` = `u2s`.`user_id`) WHERE `email` = ? AND `u2s`.`status` = ?");
$statement->execute(array($email, 1));
$the_user = $statement->fetch(PDO::FETCH_ASSOC);
if (!$the_user) {
throw new Exception(trans('error_email_address_not_found'));
}
// Check, If SMTP Server Is Enabled or Not
$driver = get_preference('email_driver');
if ($driver != 'smtp_server') {
throw new Exception(trans('error_smtp_server'));
}
$subject = trans('text_password_reset');
$recipient_name = $the_user['username'];
$from_name = get_preference('email_from');
$from_address = get_preference('email_address');
$smtp_host = get_preference('smtp_host');
$smtp_username = get_preference('smtp_username');
$smtp_password = get_preference('smtp_password');
$smtp_port = get_preference('smtp_port');
$ssl_tls = get_preference('ssl_tls');
// Start Email
require_once('_inc/vendor/PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->CharSet = 'UTF-8';
$mail->SMTPDebug = 0;
$mail->Timeout = 900;
$mail->Host = $smtp_host;
$mail->Port = $smtp_port;
$mail->Username = $smtp_username;
$mail->Password = $smtp_password;
$mail->SetFrom($smtp_username, $from_name);
$mail->AddReplyTo($smtp_username, $from_name);
$mail->Subject = $subject;
$template_name = 'password-reset';
if (!file_exists(DIR_EMAIL_TEMPLATE . $template_name . '.php') || !is_file(DIR_EMAIL_TEMPLATE . $template_name . '.php')) {
throw new Exception(trans('error_email_template_not_found'));
}
$uniqid_str = md5(uniqid(mt_rand()));
$reset_pass_link = root_url() . '/password_reset.php?fp_code=' . $uniqid_str;
ob_start();
require('_inc/template/email/' . $template_name . '.php');
$body = ob_get_contents();
ob_end_clean();
$mail->MsgHTML($body);
$mail->AddAddress($email, $recipient_name);
if (!$mail->Send()) {
throw new Exception(trans('error_unable_to_send_an_email'));
}
// End Email
// Update Users Password Reset Code
$statement = db()->prepare("UPDATE `users` SET `pass_reset_code` = ?, `reset_code_time` = ? WHERE `id` = ?");
$statement->execute(array($uniqid_str, date('Y-m-d H:i:s'), $the_user['id']));
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(array('msg' => trans('success_reset_code_sent')));
exit();
} catch (Exception $e) {
header('HTTP/1.1 422 Unprocessable Entity');
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(array('errorMsg' => $e->getMessage()));
exit();
}
} ?>
<!DOCTYPE html>
<html lang="<?php echo $document->langTag($active_lang);?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo store('name') ? store('name') . ' | ' : ''; ?><?php echo trans('title_log_in');?></title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!--Set Favicon-->
<?php if ($store->get('favicon')): ?>
<link rel="shortcut icon" href="assets/zaintechnologyinc/img/logo-favicons/<?php echo $store->get('favicon'); ?>">
<?php else: ?>
<link rel="shortcut icon" href="assets/zaintechnologyinc/img/logo-favicons/nofavicon.png">
<?php endif; ?>
<!-- All CSS -->
<!--begin::Fonts(mandatory for all pages)-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter:300,400,500,600,700" />
<!--end::Fonts-->
<!--begin::Global Stylesheets Bundle(mandatory for all pages)-->
<link href="assets/sultanui/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css" />
<link href="assets/sultanui/css/style.bundle.css" rel="stylesheet" type="text/css" />
<!--end::Global Stylesheets Bundle-->
<!-- JS -->
<!--begin::Javascript-->
<script>var hostUrl = "assets/sultanui/";</script>
<!--begin::Global Javascript Bundle(mandatory for all pages)-->
<script src="assets/sultanui/plugins/global/plugins.bundle.js"></script>
<script src="assets/sultanui/js/scripts.bundle.js"></script>
<!--end::Global Javascript Bundle-->
<!--end::Javascript-->
<script type="text/javascript">
var baseUrl = "<?php echo root_url(); ?>";
var adminDir = "<?php echo ADMINDIRNAME; ?>";
var refUrl = "<?php echo isset($request->get['redirect_to']) ? $request->get['redirect_to'] : ''?>";
</script>
<!-- jQuery JS -->
<script src="assets/jquery/jquery.min.js" type="text/javascript"></script>
<!-- Common JS -->
<script src="assets/zaintechnologyinc/js/common.js"></script>
<!-- Login JS -->
<script src="assets/zaintechnologyinc/js/login.js"></script>
<style>
body{
user-select: none;
-webkit-user-select: none;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-thumb {
border-radius: 8px;
background-color: rgba(0, 0, 0, 0.4);
}
::-webkit-scrollbar-thumb:window-inactive {
background-color: rgba(0, 0, 0, 0.25);
}
::-webkit-scrollbar-corner {
background: transparent;
}
::-webkit-resizer {
display: none;
}
.title-bar {
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: row;
width: 100%;
height: 36px;
z-index: 5000;
}
.title-bar-dragger {
margin: 5px 0 0 5px;
flex: 1;
user-select: none;
-webkit-app-region: drag;
-webkit-user-select: none;
}
.window-actions {
opacity: 0.4;
transition: 300ms cubic-bezier(0.23, 1, 0.32, 1) !important;
list-style: none;
padding: 0;
margin: 0;
z-index: 5100;
font-size: 0;
}
.window-actions li {
display: inline-block;
padding: 5px 18px;
font-size: 16px;
margin: 0;
}
/* .window-actions li:hover {
background-color: #eee;
} */
.win-close-btn:hover, #handleCose:hover {
color: #fff !important;
background-color: #fd0007 !important;
}
.title-bar:hover .window-actions {
opacity: 1;
}
</style>
</head>
<!--begin::Body-->
<body class="app-blank bgi-size-cover bgi-position-center">
<!--begin::Custom Titlebar-->
<div class="title-bar bg-light-dark">
<div class="title-bar-dragger d-flex py-2 px-10 fw-bolder align-items-center"><img src="./assets/sultanui/media/logos/favicon.ico" class="w-20px h-20px rounded me-5">SultanPOS - Swift Cashier, POS</div>
<ul v-if="showActions" class="window-actions">
<li id="handleMinimize" class="text-dark bg-hover-secondary">
<svg version="1.1" role="presentation" width="12" height="12" viewBox="0 0 12 12" class="xd-icon"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"><line x1="1" y1="6" x2="11" y2="6" fill="none" stroke-linecap="round" stroke-linejoin="round"></line></g></svg>
</li>
<li id="handleMaximize" class="text-dark bg-hover-secondary">
<svg version="1.1" role="presentation" width="12" height="12" viewBox="0 0 12 12" class="xd-icon"> <g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"><polyline points="5.5 1.5 10.5 1.5 10.5 6.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></polyline>
<polyline points="1.5 5.5 1.5 10.5 6.5 10.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></polyline></g></svg>
</li>
<li id="close-button" class="win-close-btn text-dark bg-hover-secondary">
<svg version="1.1" role="presentation" width="12" height="12" viewBox="0 0 12 12" class="xd-icon"> <g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"><line x1="1.5" y1="1.5" x2="10.5" y2="10.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></line>
<line x1="10.5" y1="1.5" x2="1.5" y2="10.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></line></g></svg>
</li>
<li id="handleClose" class="d-none"></li>
</ul>
</div>
<!--end::Custom Titlebar-->
<!--begin::Theme mode setup on page load-->
<script>var defaultThemeMode = "light"; var themeMode; if ( document.documentElement ) { if ( document.documentElement.hasAttribute("data-bs-theme-mode")) { themeMode = document.documentElement.getAttribute("data-bs-theme-mode"); } else { if ( localStorage.getItem("data-bs-theme") !== null ) { themeMode = localStorage.getItem("data-bs-theme"); } else { themeMode = defaultThemeMode; } } if (themeMode === "system") { themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } document.documentElement.setAttribute("data-bs-theme", themeMode); }</script>
<!--end::Theme mode setup on page load-->
<!--begin::Root-->
<div class="d-flex flex-column flex-root">
<!--begin::Page bg image-->
<style>body { background-image: url('assets/sultanui/media/auth/bg10.jpeg'); } [data-bs-theme="dark"] body { background-image: url('assets/sultanui/media/auth/bg10-dark.jpeg'); }</style>
<!--end::Page bg image-->
<!--begin::Authentication - Sign-in -->
<div class="d-flex flex-column flex-lg-row flex-column-fluid">
<!--begin::Aside-->
<div class="d-flex flex-lg-row-fluid">
<!--begin::Content-->
<div class="d-flex flex-column flex-center pb-0 pb-lg-10 p-10 w-100">
<!--begin::Image-->
<img class="theme-light-show mx-auto mw-100 w-150px w-lg-300px mb-10 mb-lg-20" src="assets/sultanui/media/auth/agency.png" alt="" />
<img class="theme-dark-show mx-auto mw-100 w-150px w-lg-300px mb-10 mb-lg-20" src="assets/sultanui/media/auth/agency-dark.png" alt="" />
<!--end::Image-->
<!--begin::Title-->
<h1 class="text-gray-800 fs-2qx fw-bold text-center mb-7">Fast, Efficient and Productive</h1>
<!--end::Title-->
<!--begin::Text-->
<div class="text-gray-600 fs-base text-center fw-semibold">SultanPOS is a fast, efficient,
and productive <a href="#" class="opacity-75-hover text-primary me-1">point-of-sale</a> app that
<br /> streamlines the <a href="#" class="opacity-75-hover text-primary me-1">checkout</a> process and enhances customer experience. This
<br />revolutionary app offers innovative tools for <a href="#" class="opacity-75-hover text-primary me-1">sales management,</a> making it
<br />the ultimate tool for businesses of all sizes.
</div>
<!--end::Text-->
</div>
<!--end::Content-->
</div>
<!--end::Aside-->
<!--begin::Body-->
<div class="d-flex flex-column-fluid flex-lg-row-auto justify-content-center justify-content-lg-end p-12">
<!--begin::Wrapper-->
<div class="bg-body d-flex flex-column flex-center rounded-4 w-md-600px p-10">
<!--begin::Content-->
<div class="d-flex flex-center flex-column align-items-stretch h-lg-100 w-md-400px">
<!--begin::Wrapper-->
<div class="d-flex flex-center flex-column-fluid pb-15 pb-lg-20" ng-controller="LoginController">
<!--begin::Form-->
<form class="form w-100" action="login.php" method="post">
<!--begin::Heading-->
<div class="text-center mb-11">
<!--begin::Title-->
<h1 class="text-dark fw-bolder mb-3">Sign In</h1>
<!--end::Title-->
<!--begin::Subtitle-->
<div class="text-gray-500 fw-semibold fs-6">Your Accounting Management</div>
<!--end::Subtitle=-->
</div>
<!--begin::Heading-->
<!--begin::Separator-->
<div class="separator separator-content my-14">
<span class="w-125px text-gray-500 fw-semibold fs-7">Sultan.</span>
</div>
<!--end::Separator-->
<?php if (isset($error_message)) : ?>
<!--begin::Alert-->
<div class="alert alert-danger d-flex align-items-center p-5">
<!--begin::Icon-->
<span class="svg-icon svg-icon-2hx svg-icon-danger me-3">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.3" d="M22.9558 10.2848L21.3341 8.6398C21.221 8.52901 21.1317 8.39637 21.0715 8.24996C21.0114 8.10354 20.9816 7.94641 20.9841 7.78814V5.4548C20.9826 5.13514 20.9179 4.81893 20.7938 4.52433C20.6697 4.22973 20.4887 3.96255 20.261 3.73814C20.0333 3.51374 19.7636 3.33652 19.4672 3.21668C19.1709 3.09684 18.8538 3.03673 18.5341 3.0398H16.2008C16.0425 3.04229 15.8854 3.01255 15.739 2.95238C15.5925 2.89221 15.4599 2.80287 15.3491 2.6898L13.7158 1.0448C13.2608 0.590273 12.6439 0.334961 12.0008 0.334961C11.3576 0.334961 10.7408 0.590273 10.2858 1.0448L8.64078 2.66647C8.52999 2.77954 8.39735 2.86887 8.25094 2.92904C8.10452 2.98922 7.94739 3.01896 7.78911 3.01647H5.45578C5.13612 3.01799 4.8199 3.08266 4.5253 3.20675C4.23071 3.33085 3.96353 3.51193 3.73912 3.73959C3.51471 3.96724 3.3375 4.237 3.21766 4.53335C3.09781 4.82971 3.0377 5.14682 3.04078 5.46647V7.7998C3.04327 7.95808 3.01353 8.11521 2.95335 8.26163C2.89318 8.40804 2.80385 8.54068 2.69078 8.65147L1.04578 10.2848C0.591249 10.7398 0.335938 11.3567 0.335938 11.9998C0.335938 12.6429 0.591249 13.2598 1.04578 13.7148L2.66745 15.3598C2.78051 15.4706 2.86985 15.6032 2.93002 15.7496C2.99019 15.8961 3.01994 16.0532 3.01745 16.2115V18.5448C3.01897 18.8645 3.08363 19.1807 3.20773 19.4753C3.33182 19.7699 3.5129 20.0371 3.74056 20.2615C3.96822 20.4859 4.23798 20.6631 4.53433 20.7829C4.83068 20.9028 5.14779 20.9629 5.46745 20.9598H7.80078C7.95906 20.9573 8.11619 20.9871 8.2626 21.0472C8.40902 21.1074 8.54166 21.1967 8.65245 21.3098L10.2974 22.9548C10.7525 23.4093 11.3693 23.6646 12.0124 23.6646C12.6556 23.6646 13.2724 23.4093 13.7274 22.9548L15.3608 21.3331C15.4716 21.2201 15.6042 21.1307 15.7506 21.0706C15.897 21.0104 16.0542 20.9806 16.2124 20.9831H18.5458C19.1894 20.9831 19.8066 20.7275 20.2617 20.2724C20.7168 19.8173 20.9724 19.2001 20.9724 18.5565V16.2231C20.97 16.0649 20.9997 15.9077 21.0599 15.7613C21.12 15.6149 21.2094 15.4823 21.3224 15.3715L22.9674 13.7265C23.1935 13.5002 23.3726 13.2314 23.4944 12.9357C23.6162 12.64 23.6784 12.3231 23.6773 12.0032C23.6762 11.6834 23.6119 11.3669 23.4881 11.072C23.3643 10.7771 23.1834 10.5095 22.9558 10.2848Z" fill="currentColor"/>
<path d="M12.0039 15.4998C11.7012 15.4998 11.4109 15.38 11.1969 15.1668C10.9829 14.9535 10.8626 14.6643 10.8626 14.3627V13.9382C10.8467 13.2884 10.9994 12.6456 11.306 12.0718C11.6126 11.4981 12.0627 11.013 12.6126 10.6634C12.7969 10.561 12.9505 10.4114 13.0575 10.2302C13.1645 10.049 13.221 9.84266 13.2213 9.63242C13.2213 9.31073 13.0931 9.00223 12.8648 8.77476C12.6365 8.5473 12.3268 8.41951 12.0039 8.41951C11.6811 8.41951 11.3714 8.5473 11.1431 8.77476C10.9148 9.00223 10.7865 9.31073 10.7865 9.63242C10.7865 9.93399 10.6663 10.2232 10.4523 10.4365C10.2382 10.6497 9.94792 10.7695 9.64522 10.7695C9.34253 10.7695 9.05223 10.6497 8.83819 10.4365C8.62415 10.2232 8.50391 9.93399 8.50391 9.63242C8.50763 9.02196 8.67214 8.42317 8.98099 7.89592C9.28984 7.36868 9.7322 6.93145 10.2639 6.62796C10.7955 6.32447 11.3978 6.16535 12.0105 6.16651C12.6233 6.16767 13.225 6.32908 13.7554 6.63458C14.2859 6.94009 14.7266 7.37899 15.0335 7.9074C15.3403 8.43582 15.5025 9.03522 15.5039 9.64569C15.5053 10.2562 15.3458 10.8563 15.0414 11.3861C14.7369 11.9159 14.2983 12.3568 13.7692 12.6647C13.5645 12.8132 13.4003 13.0101 13.2913 13.2378C13.1824 13.4655 13.1322 13.7167 13.1453 13.9685V14.3931C13.1373 14.6894 13.0136 14.9708 12.8004 15.1776C12.5872 15.3843 12.3014 15.4999 12.0039 15.4998Z" fill="currentColor"/>
<path d="M12.0026 18.9998C12.6469 18.9998 13.1693 18.4775 13.1693 17.8332C13.1693 17.1888 12.6469 16.6665 12.0026 16.6665C11.3583 16.6665 10.8359 17.1888 10.8359 17.8332C10.8359 18.4775 11.3583 18.9998 12.0026 18.9998Z" fill="currentColor"/>
</svg>
</span>
<!--end::Icon-->
<!--begin::Wrapper-->
<div class="d-flex flex-column">
<!--begin::Title-->
<h4 class="mb-1">Alert</h4>
<!--end::Title-->
<!--begin::Content-->
<span><?php echo $error_message ; ?></span>
<!--end::Content-->
</div>
<!--end::Wrapper-->
</div>
<!--end::Alert-->
<br/>
<?php endif; ?>
<!--begin::Input group=-->
<div class="fv-row mb-8">
<!--begin::Email-->
<input type="text" placeholder="Email" name="username"autocomplete="off" class="form-control bg-transparent" autofocus/>
<!--end::Email-->
</div>
<!--end::Input group=-->
<div class="fv-row mb-3">
<!--begin::Password-->
<input type="password" placeholder="Password" name="password" autocomplete="off" class="form-control bg-transparent" />
<!--end::Password-->
</div>
<!--end::Input group=-->
<!--begin::Wrapper-->
<div class="d-flex flex-stack flex-wrap gap-3 fs-base fw-semibold mb-8">
<div></div>
<!--begin::Link-->
<a href="#forgotPasswordModal" data-bs-toggle="modal" data-bs-target="#forgotPasswordModal" class="link-primary"><?php echo trans('text_forgot_password'); ?></a>
<!--end::Link-->
</div>
<!--end::Wrapper-->
<!--begin::Submit button-->
<div class="d-grid mb-10">
<button type="submit" id="login-btn" class="btn btn-primary">
<!--begin::Indicator label-->
<span class="indicator-label">Sign In</span>
<!--end::Indicator label-->
<!--begin::Indicator progress-->
<span class="indicator-progress">Please wait...
<span class="spinner-border spinner-border-sm align-middle ms-2"></span></span>
<!--end::Indicator progress-->
</button>
</div>
<!--end::Submit button-->
</form>
<!--end::Form-->
</div>
<!--end::Wrapper-->
<!--begin::Footer-->
<div class="d-flex flex-stack">
<!--begin::Languages-->
<div class="me-10">
<!--begin::Toggle-->
<button class="btn btn-flex btn-link btn-color-gray-700 btn-active-color-primary rotate fs-base" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-start" data-kt-menu-offset="0px, 0px">
<img data-kt-element="current-lang-flag" class="w-20px h-20px rounded me-3" src="assets/sultanui/media/flags/English.svg" alt="" />
<span data-kt-element="current-lang-name" class="me-1"><?php echo $document->langTag($active_lang);?></span>
<!--begin::Svg Icon | path: icons/duotune/arrows/arr072.svg-->
<span class="svg-icon svg-icon-5 svg-icon-muted rotate-180 m-0">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.4343 12.7344L7.25 8.55005C6.83579 8.13583 6.16421 8.13584 5.75 8.55005C5.33579 8.96426 5.33579 9.63583 5.75 10.05L11.2929 15.5929C11.6834 15.9835 12.3166 15.9835 12.7071 15.5929L18.25 10.05C18.6642 9.63584 18.6642 8.96426 18.25 8.55005C17.8358 8.13584 17.1642 8.13584 16.75 8.55005L12.5657 12.7344C12.2533 13.0468 11.7467 13.0468 11.4343 12.7344Z" fill="currentColor" />
</svg>
</span>
<!--end::Svg Icon-->
</button>
<!--end::Toggle-->
<!--begin::Menu-->
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg-light-primary fw-semibold w-200px py-4 fs-7" data-kt-menu="true" id="kt_auth_lang_menu">
<?php foreach(get_langs() as $the_lang):?>
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="<?php echo $_SERVER['PHP_SELF'];?>?lang=<?php echo $the_lang['code'];?>" class="menu-link d-flex px-5">
<span class="symbol symbol-20px me-4">
<img class="rounded-1" src="assets/sultanui/media/flags/<?php echo trans($the_lang['name']); ?>.svg" alt="<?php echo $the_lang['code'];?>" />
</span>
<span><?php echo trans('text_'.$the_lang['name']); ?></span>
</a>
</div>
<!--end::Menu item-->
<?php endforeach ?>
</div>
<!--end::Menu-->
</div>
<!--end::Languages-->
<!--begin::Links-->
<div class="d-flex fw-semibold text-muted fs-base gap-1">
© <?=date('Y')?> <a href="https://fb.me/sultan.asad01">Sultan Technologies</a>, v<?php echo settings('version'); ?>
</div>
<!--end::Links-->
</div>
<!--end::Footer-->
</div>
<!--end::Content-->
</div>
<!--end::Wrapper-->
</div>
<!--end::Body-->
</div>
<!--end::Authentication - Sign-in-->
</div>
<!--end::Root-->
<!--Forgot Password Modal Start -->
<div class="modal fade" tabindex="-1" id="forgotPasswordModal">
<div class="modal-dialog">
<div class="modal-content">
<form action="#" method="post" accept-charset="utf-8">
<div class="modal-header">
<h3 class="modal-title"><?php echo trans('title_forgot_password'); ?></h3>
<!--begin::Close-->
<div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
<span class="svg-icon svg-icon-1">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.3" d="M6.7 19.4L5.3 18C4.9 17.6 4.9 17 5.3 16.6L16.6 5.3C17 4.9 17.6 4.9 18 5.3L19.4 6.7C19.8 7.1 19.8 7.7 19.4 8.1L8.1 19.4C7.8 19.8 7.1 19.8 6.7 19.4Z" fill="currentColor"/>
<path d="M19.5 18L18.1 19.4C17.7 19.8 17.1 19.8 16.7 19.4L5.40001 8.1C5.00001 7.7 5.00001 7.1 5.40001 6.7L6.80001 5.3C7.20001 4.9 7.80001 4.9 8.20001 5.3L19.5 16.6C19.9 16.9 19.9 17.6 19.5 18Z" fill="currentColor"/>
</svg>
</span>
</div>
<!--end::Close-->
</div>
<div class="modal-body">
<label for="email"><?php echo trans('text_forgot_password_instruction'); ?></label>
<input id="email" type="email" name="email" placeholder="Email" autocomplete="off" class="form-control">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><?php echo trans('button_close'); ?></button>
<button id="reset-btn" name="reset-btn" type="submit" class="btn btn-primary"><?php echo trans('button_submit'); ?></button>
</div>
</form>
</div>
</div>
</div>
<!-- Forgot Password Modal End -->
<noscript>You need to have javascript enabled in order to use <strong><?php echo store('name');?></strong>.</noscript>
<!-- Add a script to handle the button click event -->
<script>
document.addEventListener('dragstart', (event) => {
event.preventDefault();
});
function showConfirmationModal() {
Swal.fire({
title: 'Are you sure?',
text: "Do you want to close SultanPOS!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3E97FF',
cancelButtonColor: '#fd0007',
confirmButtonText: 'Yes, close it!',
cancelButtonText: 'Cancel'
}).then((result) => {
if (result.isConfirmed) {
// Handle the "Ok" button click event
const handleCloseButton = document.getElementById('handleClose');
handleCloseButton.click();
}
});
}
const closeButton = document.getElementById('close-button');
closeButton.addEventListener('click', () => {
showConfirmationModal();
});
$(document).keydown(function(e) {
if ((e.altKey && e.which == 115) || (e.metaKey && e.which == 115)) { // alt+f4 or command+f4
showConfirmationModal();
// e.preventDefault(); // prevent default behavior of the key combination
return false;
}
});
</script>
</body>
<!--end::Body-->
</html>