From 198786ed908c6a0ce11f992cb565add767cc93e4 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 3 Dec 2019 10:37:47 +0100 Subject: [PATCH] Login from accounts --- www/auth/main.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/www/auth/main.js b/www/auth/main.js index d019c1a8c..878393012 100644 --- a/www/auth/main.js +++ b/www/auth/main.js @@ -6,11 +6,12 @@ define([ '/common/outer/local-store.js', '/common/outer/login-block.js', '/common/outer/network-config.js', + '/customize/login.js', '/common/test.js', '/bower_components/nthen/index.js', '/bower_components/netflux-websocket/netflux-client.js', '/bower_components/tweetnacl/nacl-fast.min.js' -], function ($, Crypt, Pinpad, Constants, LocalStore, Block, NetConfig, Test, nThen, Netflux) { +], function ($, Crypt, Pinpad, Constants, LocalStore, Block, NetConfig, Login, Test, nThen, Netflux) { var Nacl = window.nacl; var signMsg = function (msg, privKey) { @@ -96,9 +97,16 @@ define([ if (data.cmd === 'PING') { ret.res = 'PONG'; } else if (data.cmd === 'LOGIN') { - UI.alert('okok'); + Login.loginOrRegister(data.data.name, data.data.password, false, false, function (err, res) { + if (err) { + ret.error = 'LOGIN_ERROR' + srcWindow.postMessage(JSON.stringify(ret), domain); + return; + } + loadProxy(LocalStore.getUserHash()); + srcWindow.postMessage(JSON.stringify(ret), domain); + }); return; - // XXX Display login modal.... } else if (data.cmd === 'SIGN') { if (!AUTHORIZED_DOMAINS.filter(function (x) { return x.test(domain); }).length) { ret.error = "UNAUTH_DOMAIN";