diff options
Diffstat (limited to 'public/includes/ui-login.php')
| -rw-r--r-- | public/includes/ui-login.php | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/public/includes/ui-login.php b/public/includes/ui-login.php new file mode 100644 index 0000000..8ab4d9b --- /dev/null +++ b/public/includes/ui-login.php @@ -0,0 +1,98 @@ +<!DOCTYPE html> +<html prefix="og: http://ogp.me/ns#" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB" dir="ltr"> + <head> + <!-- Metas + Title --> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + + <title><?=PROJECT?> : Είσοδος</title> + + <!-- CSS needed --> + <link rel="stylesheet" href="/css/bootstrap.min.css" /><!-- v4.4.1 --> + <link rel="stylesheet" href="/css/select2.min.css" /><!-- v4.0.10 --> + <link rel="stylesheet" href="/css/pi.css" /> + </head> + <body> + + <div class="login-container"> + <div class="row"> + <div class="col-md-12"> + <h2><?=PROJECT?></h2> + <h4>Είσοδος στη βάση δεδομένων</h4> + <hr /> + + <form id="kallassa-login" method="post"> + + <div class="form-group"> + <label for="user">Email χρήστη</label> + <input class="form-control" type="email" name="email" required> + </div> + <div class="form-group"> + <label for="pass">Κωδικός πρόσβασης</label> + <input class="form-control" type="password" name="pass" required> + </div> + <br /> + + <input class="btn btn-primary" type="submit" value="Πιστοποίηση Χρήστη"> + + </form> + + </div> + </div> + </div> + + <!-- scripts and libraries + load and register one by one, so you don't need to worry about if they are ready --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.4.1/jquery-migrate.min.js"></script> + <script src="/js/bootstrap.min.js"></script> + <script> + // LOGIN + // ------------------------------------------------------------------------- + $('#kallassa-login').on('submit', function (e) { + if (e.isDefaultPrevented()) { // handle the invalid form... + alert('WTF validation error'); + } + else { // everything looks good! + + var postUrl = "/ajax.php?do=login"; + var data2send = { + user : $('#kallassa-login input[name=email]').val(), + pass : $('#kallassa-login input[name=pass]').val() + }; + + $.ajax({ + type: "POST", + url: postUrl, + data: data2send, + success: function(data) { + var json = $.parseJSON(data); + // ** Workaround + // ** for server may handle respond as json ready + // ** var json = data + + if (json.success) { // good! user is ok + + // reset form + $('#kallassa-login').trigger("reset"); + + // and goto root (will load control panel) + window.location.href = '/'; + + } + else { // nope! + alert("Login Failed; try again."); + } + + }, + error: function() { alert('WTF ajax error'); } + }); + return false; + } + }); + + </script> + + </body> +</html> |
