
   <head>

      <title>CMS - LOGIN: Pharmatheka consult</title>

      <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

      <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto">
      <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
      <link rel="stylesheet" type="text/css" href="resursi/login.css" />

      <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

      <script>

         zapamti    = <?php echo $user["remember"]; ?>;
         automatski = <?php echo $user["autoload"]; ?>;
         korisnik   = "<?php echo $user["name"]." - ".$_SESSION["candidate"]; ?>";

         $(document).ready(function() {

            $("#wrapper").fadeIn(1500, function() {
               $(".input-container input").prop("disabled", false);
               $("#e-mail").focus();
               $("#e-mail").val("<?php echo $user["remember"] == 1 ? $user["mail"] : ""; ?>");
               $("#password").val("<?php echo ($user["remember"] == 1 && (int)$_SESSION["candidate"] != 0) ? "123456789" : ""; ?>");
               if(1 == <?php echo ($user["autoload"] == "" || (int)$_SESSION["candidate"] == 0) ? 0 : $user["autoload"]; ?>) {
                  $("#auto-prijava strong").text("<?php echo $user["name"]; ?>");
                  autoLogin();
               }
            });

            $(".check-container a").click(function() {
               var checkObj = $(this).attr("href");
               var isChecked = $(checkObj).prop("checked");
               $(checkObj).prop("checked", !isChecked);
               if($(this).attr("href") === "#automatski" && $("#automatski").prop("checked"))
                  $("#zapamti").prop("checked", true);
            });

            $("#automatski, #zapamti, [href='#zapamti']").click(function() {
               if($("#automatski").prop("checked")) $("#zapamti").prop("checked", true);
            });

            $("#zaborav").click(function() {
               $("#wrapper").fadeOut(600, function() {
                  $("#zaboravko").fadeIn(600);
               });
            });

            $("#natrag").click(function() {
               $("#zaboravko").fadeOut(600, function() {
                  $("#wrapper").fadeIn(600);
               });
            });

            $("#natragz").click(function() {
               $("#dajZaporku").fadeOut(600, function() {
                  $("#wrapper").fadeIn(600);
               });
            });

            $("#prijava").click(function() {
            /*
               if(<?php echo $_SESSION["candidate"]; ?> > 0) {
                  <?php $_SESSION["user"] = $_SESSION["candidate"]; ?>
                  window.location.href = "../cms.php";
                  return;
               }
               
               $.post("logme.php", { mail: $("#e-mail").val() }, function(data) {
                  var json = $.parseJSON(data);
                  if(json["status"] === "ERROR") alert("GREŠKA");
                  else {
                     if(json["hash"] !== "") {
                        $("#wrapper").fadeOut(600, function() {
                           $("#dajZaporku").fadeIn(600);
                        });
                     }
                  }
               });
*/
            });

         });

         function autoLogin() {
            if(1 == <?php echo $_SESSION["LoggedOut"]; ?>) return;
            $("#kontrole, .check-container").fadeOut(100, function() {
               $("#progress-slider").width("0px");
               $("#auto-prijava").fadeIn(100);
               $("#progress-slider").animate({ width: "100%" }, 2000, function() {
                  <?php $_SESSION["user"] = $_SESSION["candidate"]; $_SESSION["LoggedIn"] = 1; ?>
                  window.location.reload();
               }); 
            });
         }

      </script>

   </head>

   <body class="noselect">

      <div id="spike"></div>

      <form id="wrapper" method="post" action="">

         <i id="user-icon" class="fa fa-user-circle-o"></i>

         <div class="input-container">
            <i class="fa fa-envelope-o"></i>
            <input type="text" id="e-mail" placeholder="upišite e-mail..." value="" disabled />
         </div>

         <div class="input-container">
            <i class="fa fa-key"></i>
            <input type="password" id="password" placeholder="upišite zaporku..." value="" disabled />
         </div>

         <div id="kontrole">
            <button id="prijava" class="round-button violetblack">PRIJAVI SE...</button>
            <br /><br />
            <a href="#" id="zaborav" class="regular-link">Zaboravljena zaporka...</a>
         </div>

         <div id="auto-prijava">
            Automatska prijava:<br /><strong></strong>
            <div id="progress-container">
               <div id="progress-slider" class="violetblack"></div>
            </div>
         </div>

         <div class="check-container">
            <input id="zapamti" type="checkbox"<?php echo $user["remember"] == 1 ? " checked" : ""; ?> />
            <a href="#zapamti" class="regular-link">Zapamti me na ovom računalu...</a>
            <br />
            <input id="automatski" type="checkbox"<?php echo $user["autoload"] == 1 ? " checked" : ""; ?> />
            <a href="#automatski" class="regular-link">Automatska prijava...</a>
         </div>

      </form>

      <form id="zaboravko" method="post" action="/form">

         <a href="#" id="natrag"><i class="fa fa-arrow-circle-o-left"></i></a>

         <i id="question-icon" class="fa fa-question-circle-o"></i>

         <div class="input-container">
            <i class="fa fa-envelope-o"></i>
            <input type="text" id="e-mail-zaboravko" placeholder="upišite e-mail..." value="<?php echo $user["mail"]; ?>" />
            <a href="#posalji"class="round-button violetblack">POŠALJI...</a>
         </div>

         <div class="zaborav-container">
            <strong>UPUTA:</strong><br />Na e-mail koji upišete u polje poslati<br />ćemo poveznicu za ponovo postavljanje<br />Vaše zaporke.
         </div>

      </form>

      <form id="dajZaporku" method="post" action="/form">

         <a href="#" id="natragz"><i class="fa fa-arrow-circle-o-left"></i></a>

         <i id="question-icon" class="fa fa-key"></i>

         <div class="input-container">
            <i class="fa fa-key"></i>
            <input type="password" id="passwordA" placeholder="upišite zaporku..." value="" />
         </div>

         <div class="input-container">
            <i class="fa fa-key"></i>
            <input type="password" id="passwordB" placeholder="ponovite zaporku..." value="" />
         </div>
         <br /><a href="#" id="zaporkaUnos" class="round-button violetblack">SPREMI ZAPORKU...</a>
         <br />
         <div class="zaborav-container">
            <strong>POČETNA ZAPORKA:</strong><br />
               Početnu zaporku morate promijeniti.<br />Unesite je 2 puta.<br />
               Zaporka mora sadržavati najmanje:<br />
               <ul><li>1 veliko slovo + 1 malo slovo,</li><li>1 broj + 1 znak interpunkcije,</li><li>mora biti najmanje 6 znakova duga.</ul>
               Npr.: <em>Vlatka2212!</em>
         </div>

      </form>

   </body>
