fix installationId usage; disable in-app logout for now
fix installationId usage; disable in-app logout for now fix
This commit is contained in:
parent
fe82f762bb
commit
116b04a9ef
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -92,7 +92,7 @@ let DEFAULT_NETWORKS* = %* [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
let NODE_CONFIG* = %* {
|
var NODE_CONFIG* = %* {
|
||||||
"BrowsersConfig": {
|
"BrowsersConfig": {
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue