An easy point of sale system with automatic inventory tracking. https://netsyms.biz/apps/nickelbox/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.php 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. require_once __DIR__ . "/required.php";
  6. require_once __DIR__ . "/lib/login.php";
  7. // if we're logged in, we don't need to be here.
  8. if ($_SESSION['loggedin']) {
  9. header('Location: app.php');
  10. }
  11. /* Authenticate user */
  12. $userpass_ok = false;
  13. $multiauth = false;
  14. if (checkLoginServer()) {
  15. if ($VARS['progress'] == "1") {
  16. if (!RECAPTCHA_ENABLED || (RECAPTCHA_ENABLED && verifyReCaptcha($VARS['g-recaptcha-response']))) {
  17. $errmsg = "";
  18. if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) {
  19. switch (get_account_status($VARS['username'])) {
  20. case "LOCKED_OR_DISABLED":
  21. $alert = lang("account locked", false);
  22. break;
  23. case "TERMINATED":
  24. $alert = lang("account terminated", false);
  25. break;
  26. case "CHANGE_PASSWORD":
  27. $alert = lang("password expired", false);
  28. case "NORMAL":
  29. $userpass_ok = true;
  30. break;
  31. case "ALERT_ON_ACCESS":
  32. sendLoginAlertEmail($VARS['username']);
  33. $userpass_ok = true;
  34. break;
  35. }
  36. if ($userpass_ok) {
  37. $_SESSION['passok'] = true; // stop logins using only username and authcode
  38. if (userHasTOTP($VARS['username'])) {
  39. $multiauth = true;
  40. } else {
  41. doLoginUser($VARS['username'], $VARS['password']);
  42. header('Location: app.php');
  43. die("Logged in, go to app.php");
  44. }
  45. }
  46. } else {
  47. if (!is_empty($errmsg)) {
  48. $alert = lang2("login server error", ['arg' => $errmsg], false);
  49. } else {
  50. $alert = lang("login incorrect", false);
  51. }
  52. }
  53. } else {
  54. $alert = lang("captcha error", false);
  55. }
  56. } else if ($VARS['progress'] == "2") {
  57. if ($_SESSION['passok'] !== true) {
  58. // stop logins using only username and authcode
  59. sendError("Password integrity check failed!");
  60. }
  61. if (verifyTOTP($VARS['username'], $VARS['authcode'])) {
  62. if (doLoginUser($VARS['username'])) {
  63. header('Location: app.php');
  64. die("Logged in, go to app.php");
  65. } else {
  66. $alert = lang("login server user data error", false);
  67. }
  68. } else {
  69. $alert = lang("2fa incorrect", false);
  70. }
  71. }
  72. } else {
  73. $alert = lang("login server unavailable", false);
  74. }
  75. header("Link: <static/css/bootstrap.min.css>; rel=preload; as=style", false);
  76. header("Link: <static/css/material-color/material-color.min.css>; rel=preload; as=style", false);
  77. header("Link: <static/css/index.css>; rel=preload; as=style", false);
  78. header("Link: <static/js/jquery-3.3.1.min.js>; rel=preload; as=script", false);
  79. header("Link: <static/js/bootstrap.min.js>; rel=preload; as=script", false);
  80. ?>
  81. <!DOCTYPE html>
  82. <html>
  83. <head>
  84. <meta charset="UTF-8">
  85. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  86. <meta name="viewport" content="width=device-width, initial-scale=1">
  87. <title><?php echo SITE_TITLE; ?></title>
  88. <link rel="icon" href="static/img/logo.svg">
  89. <link href="static/css/bootstrap.min.css" rel="stylesheet">
  90. <link href="static/css/material-color/material-color.min.css" rel="stylesheet">
  91. <link href="static/css/index.css" rel="stylesheet">
  92. <?php if (RECAPTCHA_ENABLED) { ?>
  93. <script src='https://www.google.com/recaptcha/api.js'></script>
  94. <?php } ?>
  95. </head>
  96. <body>
  97. <div class="row justify-content-center">
  98. <div class="col-auto">
  99. <img class="banner-image" src="static/img/logo.png" />
  100. </div>
  101. </div>
  102. <div class="row justify-content-center">
  103. <div class="card col-11 col-xs-11 col-sm-8 col-md-6 col-lg-4">
  104. <div class="card-body">
  105. <h5 class="card-title"><?php lang("sign in"); ?></h5>
  106. <form action="" method="POST">
  107. <?php
  108. if (!is_empty($alert)) {
  109. ?>
  110. <div class="alert alert-danger">
  111. <i class="fa fa-fw fa-exclamation-triangle"></i> <?php echo $alert; ?>
  112. </div>
  113. <?php
  114. }
  115. if ($multiauth != true) {
  116. ?>
  117. <input type="text" class="form-control" name="username" placeholder="<?php lang("username"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus /><br />
  118. <input type="password" class="form-control" name="password" placeholder="<?php lang("password"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /><br />
  119. <?php if (RECAPTCHA_ENABLED) { ?>
  120. <div class="g-recaptcha" data-sitekey="<?php echo RECAPTCHA_SITE_KEY; ?>"></div>
  121. <br />
  122. <?php } ?>
  123. <input type="hidden" name="progress" value="1" />
  124. <?php
  125. } else if ($multiauth) {
  126. ?>
  127. <div class="alert alert-info">
  128. <?php lang("2fa prompt"); ?>
  129. </div>
  130. <input type="text" class="form-control" name="authcode" placeholder="<?php lang("authcode"); ?>" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus /><br />
  131. <input type="hidden" name="progress" value="2" />
  132. <input type="hidden" name="username" value="<?php echo $VARS['username']; ?>" />
  133. <?php
  134. }
  135. ?>
  136. <button type="submit" class="btn btn-primary">
  137. <?php lang("continue"); ?>
  138. </button>
  139. </form>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="footer">
  144. <?php echo FOOTER_TEXT; ?><br />
  145. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  146. </div>
  147. </div>
  148. <script src="static/js/jquery-3.3.1.min.js"></script>
  149. <script src="static/js/bootstrap.min.js"></script>
  150. </body>
  151. </html>