Show authentication errors
This commit is contained in:
parent
c341d7a0b6
commit
c484b83aca
|
@ -541,6 +541,10 @@ button {
|
|||
#sign-in .btn {
|
||||
margin-top: 25px;
|
||||
}
|
||||
#sign-in .error {
|
||||
color: #e74c3c;
|
||||
margin-top: 1em;
|
||||
}
|
||||
#connect label {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<link rel="shortcut icon" href="/img/favicon.png">
|
||||
|
||||
</head>
|
||||
<body class="<%= public ? "public" : "signed-out" %>">
|
||||
<body class="<%= public ? "public" : "" %>">
|
||||
|
||||
<div id="wrap">
|
||||
<div id="viewport">
|
||||
|
@ -57,6 +57,9 @@
|
|||
<input class="input" type="password" name="password">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-xs-12 error" style="display: none;">
|
||||
Authentication failed.
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<button type="submit" class="btn">
|
||||
Sign in
|
||||
|
|
|
@ -58,8 +58,16 @@ $(function() {
|
|||
});
|
||||
|
||||
socket.on("auth", function(data) {
|
||||
$("body").addClass("signed-out");
|
||||
$("#sign-in input[name='user']").val($.cookie("user") || "");
|
||||
var body = $("body");
|
||||
var login = $("#sign-in");
|
||||
if (body.hasClass("signed-out")) {
|
||||
var error = login.find(".error");
|
||||
error.show().closest("form").one("submit", function() {
|
||||
error.hide();
|
||||
});
|
||||
}
|
||||
body.addClass("signed-out");
|
||||
login.find("input[name='user']").val($.cookie("user") || "");
|
||||
sidebar.find(".sign-in")
|
||||
.click()
|
||||
.end()
|
||||
|
|
|
@ -129,11 +129,16 @@ function auth(data) {
|
|||
});
|
||||
init(socket, client);
|
||||
} else {
|
||||
var success = 0;
|
||||
_.each(clients, function(client) {
|
||||
if (client.config.name == data.name && client.config.password == data.password) {
|
||||
init(socket, client);
|
||||
success++;
|
||||
}
|
||||
});
|
||||
if (!success) {
|
||||
socket.emit("auth");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "shout",
|
||||
"description": "A web IRC client",
|
||||
"version": "0.8.4",
|
||||
"version": "0.8.5",
|
||||
"homepage": "http://github.com/erming/shout",
|
||||
"author": {
|
||||
"name": "Mattias Erming",
|
||||
|
|
Loading…
Reference in New Issue