login fixed

This commit is contained in:
Marc Wäckerlin
2017-03-14 10:59:11 +00:00
parent f6ed33dad1
commit 18a92c7f40
5 changed files with 1864 additions and 11 deletions

View File

@@ -8,8 +8,8 @@
"ejs": ">= 0.0.1",
"socket.io": "~1.4.4",
"socketio-auth": "0.0.5",
"authentication.js": ">= 1.0.0",
"docker.js": ">= 0.2.4"
"authentication.js": ">= 1.1.0",
"docker.js": ">= 0.5.0"
},
"description": "@DESCRIPTION@",
"main": "@PACKAGE_NAME@.js",

View File

@@ -347,6 +347,17 @@ table.docker li+li {
color: green;
}
#login form {
display: table;
}
#login form .row {
display: table-row;
}
#login form .row > * {
display: table-cell;
}
#console {
background-color: black;
color: white;

View File

@@ -13,12 +13,12 @@ module.exports = function(app, io, authentication) {
authenticate: function (socket, data, callback) {
console.log("=> authenticate: ", data.username);
authentication(data.username, data.password,
function() {
console.log("####LOGIN-SUCESS####");
function(username) {
console.log("user logged in", username);
callback(null, true)
},
function() {
console.log("####LOGIN-FAIL####");
function(username, where, err) {
console.log("login failed", username, where, err);
callback(new Error("wrong credentials"))
});
},

View File

@@ -48,11 +48,17 @@
<div id="login">
<h1>Login</h1>
<form onsubmit="connect()">
<label for="usernamefield">User Name</label>
<input placeholder="User Name" id="usernamefield" type="text" />
<label for="passwordfield">Password</label>
<input placeholder="Password" id="passwordfield" type="password" />
<button type="button" onclick="connect()">Login</button>
<div class="row">
<label for="usernamefield">User Name: </label>
<input placeholder="User Name" id="usernamefield" type="text" />
</div>
<div class="row">
<label for="passwordfield">Password: </label>
<input placeholder="Password" id="passwordfield" type="password" />
</div>
<div class="row">
<input type="submit" onclick="connect()" value="Login" />
</div>
</form>
</div>