now authenticating sockets by checking the password hash

This commit is contained in:
2016-08-16 04:48:42 +02:00
parent abe4d22226
commit c81a41b365
11 changed files with 37 additions and 14 deletions

View File

@@ -69,10 +69,10 @@ export class SocketConnection {
*/
authenticate() {
let done = plugins.q.defer();
this.socket.on("dataAuth", dataArg => {
this.socket.on("dataAuth", (dataArg:ISocketConnectionAuthenticationObject) => {
plugins.beautylog.log("received authentication data. now hashing and comparing...");
this.socket.removeListener("dataAuth", () => { });
if ((true)) { // TODO: authenticate password
if (helpers.checkPasswordForRole(dataArg)) { // TODO: authenticate password
this.alias = dataArg.alias
this.authenticated = true;
this.role = helpers.getSocketRoleByName(dataArg.role);