summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-09-18 11:43:11 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-09-18 11:43:11 (GMT)
commitfe521de6aa34bf2976a8bcf2f7c4ff664059f448 (patch)
tree92fa96f0908aa7b7414259cf75590917c3f71516 /index.html
parente4fc9b3dbb0a6d9d1a16f69c8c9494b672d0e322 (diff)
login screen is now pretty pretty ;)
Diffstat (limited to 'index.html')
-rw-r--r--index.html56
1 files changed, 46 insertions, 10 deletions
diff --git a/index.html b/index.html
index b697a2f..f48bd37 100644
--- a/index.html
+++ b/index.html
@@ -22,17 +22,32 @@
</style>
<link href="/javascript/twitter-bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<script src="/javascript/jquery/jquery.min.js"></script>
+ <script src="/javascript/twitter-bootstrap/js/bootstrap.min.js"></script>
+ <script src="/javascript/twitter-bootstrap/js/bootstrap-alert.min.js"></script>
<script type="text/javascript">
+ var username;
+ var token;
+ var logged_in = false;
+
+
function authSuccess(data) {
if (data.status == 'OK') {
- alert("username: " + data.username + "\ntoken: " + data.token );
+ logged_in = true;
+ username = data.username;
+ token = data.token;
+ $('#loginbox').hide('slide');
} else {
- alert("login error: " + data.errorstring);
+ alertbox.error("Fehler beim Login", data.errorstring);
+ logged_in = false;
}
}
function authError(req, status, error) {
- alert(status + ": '" + error + "'")
+ message = req.status + ': ' + error;
+ if(req.status == 401) {
+ message = "Benutzer und/oder Passwort sind falsch!";
+ }
+ alertbox.error("Fehler beim Login", message);
}
function auth()
@@ -46,22 +61,43 @@
success: authSuccess
});
}
+
+ alertbox = function() {}
+ alertbox.warning = function (heading, message) {
+ $('#alertbox').html('<div class="alert"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
+ }
+ alertbox.error = function (heading, message) {
+ $('#alertbox').html('<div class="alert alert-error"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
+ }
+ alertbox.info = function (heading, message) {
+ $('#alertbox').html('<div class="alert alert-info"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
+ }
</script>
</head>
<body>
<div class="container">
- <form id="loginform" class="form-signin" role="form">
- <img src="/img/helsinki.png" />
- <h1 class="form-signin-heading">Radio Helsinki - Import</h1>
- <input id="username" type="text" class="form-control" placeholder="Benutzername" required autofocus>
- <input id="password" type="password" class="form-control" placeholder="Passwort" required>
- <button class="btn btn-primary btn-large" type="submit"><i class="icon-user icon-white"></i> Einloggen</button>
- </form>
+
+ <div id="loginbox">
+ <form id="loginform" class="form-signin" role="form">
+ <img src="/img/helsinki.png" />
+ <h1 class="form-signin-heading">Radio Helsinki - Import</h1>
+ <div id="alertbox"></div>
+ <input id="username" type="text" class="form-control" placeholder="Benutzername" required autofocus>
+ <input id="password" type="password" class="form-control" placeholder="Passwort" required>
+ <button class="btn btn-primary btn-large" type="submit"><i class="icon-user icon-white"></i> Einloggen</button>
+ </form>
+ </div>
+
+
+
</div>
<script type="text/javascript">
$("#loginform").submit(function(event) { auth(); event.preventDefault(); });
+ if(logged_in == true) {
+ $("#loginbox").hide();
+ }
</script>
</body>