fix installationId usage; disable in-app logout for now

fix installationId usage; disable in-app logout for now

fix
This commit is contained in:
Iuri Matias 2020-06-17 12:13:13 -04:00
parent fe82f762bb
commit 116b04a9ef
4 changed files with 15 additions and 10 deletions

View File

@ -48,7 +48,7 @@ proc mainProc() =
var profile = profile.newController(status) var profile = profile.newController(status)
engine.setRootContextProperty("profileModel", profile.variant) engine.setRootContextProperty("profileModel", profile.variant)
status.events.on("login") do(a: Args): status.events.once("login") do(a: Args):
var args = AccountArgs(a) var args = AccountArgs(a)
status.startMessenger() status.startMessenger()
chat.init() chat.init()
@ -72,7 +72,7 @@ proc mainProc() =
initControllers() initControllers()
# Handle node.stopped signal when user has logged out # Handle node.stopped signal when user has logged out
status.events.on("nodeStopped") do(a: Args): status.events.once("nodeStopped") do(a: Args):
# TODO: remove this once accounts are not tracked in the AccountsModel # TODO: remove this once accounts are not tracked in the AccountsModel
status.reset() status.reset()

View File

@ -109,7 +109,7 @@ proc getAccountData*(account: GeneratedAccount): JsonNode =
"keycard-pairing": nil "keycard-pairing": nil
} }
proc getAccountSettings*(account: GeneratedAccount, defaultNetworks: JsonNode): JsonNode = proc getAccountSettings*(account: GeneratedAccount, defaultNetworks: JsonNode, installationId: string): JsonNode =
result = %* { result = %* {
"key-uid": account.keyUid, "key-uid": account.keyUid,
"mnemonic": account.mnemonic, "mnemonic": account.mnemonic,
@ -132,20 +132,23 @@ proc getAccountSettings*(account: GeneratedAccount, defaultNetworks: JsonNode):
}, },
"appearance": 0, "appearance": 0,
"networks/current-network": "mainnet_rpc", "networks/current-network": "mainnet_rpc",
"installation-id": $genUUID() "installation-id": installationId
} }
proc setupAccount*(account: GeneratedAccount, password: string): types.Account = proc setupAccount*(account: GeneratedAccount, password: string): types.Account =
try: try:
let storeDerivedResult = storeDerivedAccounts(account, password) let storeDerivedResult = storeDerivedAccounts(account, password)
let accountData = getAccountData(account) let accountData = getAccountData(account)
var settingsJSON = getAccountSettings(account, constants.DEFAULT_NETWORKS) let installationId = $genUUID()
var settingsJSON = getAccountSettings(account, constants.DEFAULT_NETWORKS, installationId)
var nodeConfig = constants.NODE_CONFIG
nodeConfig["ShhextConfig"]["InstallationID"] = newJString(installationId)
result = saveAccountAndLogin(account, $accountData, password, $constants.NODE_CONFIG, $settingsJSON) result = saveAccountAndLogin(account, $accountData, password, $nodeConfig, $settingsJSON)
except StatusGoException as e: except StatusGoException as e:
raise newException(StatusGoException, "Error setting up account: " & e.msg) raise newException(StatusGoException, "Error setting up account: " & e.msg)
finally: finally:
# TODO this is needed for now for the retrieving of past messages. We'll either move or remove it later # TODO this is needed for now for the retrieving of past messages. We'll either move or remove it later
let peer = "enode://44160e22e8b42bd32a06c1532165fa9e096eebedd7fa6d6e5f8bbef0440bc4a4591fe3651be68193a7ec029021cdb496cfe1d7f9f1dc69eb99226e6f39a7a5d4@35.225.221.245:443" let peer = "enode://44160e22e8b42bd32a06c1532165fa9e096eebedd7fa6d6e5f8bbef0440bc4a4591fe3651be68193a7ec029021cdb496cfe1d7f9f1dc69eb99226e6f39a7a5d4@35.225.221.245:443"

View File

@ -92,7 +92,7 @@ let DEFAULT_NETWORKS* = %* [
} }
] ]
let NODE_CONFIG* = %* { var NODE_CONFIG* = %* {
"BrowsersConfig": { "BrowsersConfig": {
"Enabled": true "Enabled": true
}, },

View File

@ -26,10 +26,12 @@ Item {
id: btnLogout id: btnLogout
anchors.top: txtTitle.bottom anchors.top: txtTitle.bottom
anchors.topMargin: Theme.padding anchors.topMargin: Theme.padding
label: qsTr("Logout") // label: qsTr("Logout")
label: qsTr("Exit")
onClicked: { onClicked: {
profileModel.logout(); // profileModel.logout();
Qt.quit();
} }
} }
} }