diff --git a/html/js/controllers/generate_wallet.js b/html/js/controllers/generate_wallet.js index 9bfb0cc..ea52882 100755 --- a/html/js/controllers/generate_wallet.js +++ b/html/js/controllers/generate_wallet.js @@ -58,6 +58,7 @@ thinwalletCtrls.controller('GenerateWalletCtrl', function ($scope, $location, Ac } //var keys = cnUtil.create_address(seed); var keys = cnUtil.create_address(seed); + AccountService.login(keys.public_addr, keys.view.sec, keys.spend.sec, seed, true) .then(function () { $location.path("/overview"); diff --git a/html/js/services/account.js b/html/js/services/account.js index 7f70e07..cf69d62 100755 --- a/html/js/services/account.js +++ b/html/js/services/account.js @@ -52,10 +52,13 @@ thinwalletServices view_only = false; $rootScope.$broadcast(EVENT_CODES.authStatusChanged); }; + accountService.login = function(address, view_key, spend_key, seed, generated_account) { spend_key = spend_key || ""; + generated_account = generated_account || false; + var deferred = $q.defer(); logging_in = true; (function() { @@ -117,6 +120,9 @@ thinwalletServices deferred.reject(data.reason); return; } + + //console.log(data); + account_imported = !generated_account && data.new_address; logging_in = false; $rootScope.$broadcast(EVENT_CODES.authStatusChanged); diff --git a/src/YourMoneroRequests.cpp b/src/YourMoneroRequests.cpp index 73623cc..54692d8 100755 --- a/src/YourMoneroRequests.cpp +++ b/src/YourMoneroRequests.cpp @@ -62,6 +62,9 @@ YourMoneroRequests::login(const shared_ptr session, const Bytes & body) uint64_t acc_id {0}; + // marks if this is new account creation or not + bool new_account_created {false}; + // first check if new account // select this account if its existing one if (!xmr_accounts->select(xmr_address, acc)) @@ -103,6 +106,13 @@ YourMoneroRequests::login(const shared_ptr session, const Bytes & body) session_close(session, j_response.dump()); return; } + + // set this flag to indicate that we have just created a + // new account in mysql. this information is sent to front-end + // as it can disply some greeting window to new users upon + // their first install + new_account_created = true; + } // if (!xmr_accounts->select(xmr_address, acc)) @@ -113,7 +123,10 @@ YourMoneroRequests::login(const shared_ptr session, const Bytes & body) { // if successfuly logged in and created search thread j_response["status"] = "success"; - j_response["new_address"] = false; + + // we overwrite what ever was sent in login_and_start_search_thread + // for the j_response["new_address"]. + j_response["new_address"] = new_account_created; } else {