Accounts service is cleared if on NodeStopped signal

This commit is contained in:
Sale Djenic 2021-10-17 13:40:58 +02:00 committed by Iuri Matias
parent 11cdd608f3
commit 72197f86f5
3 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,7 @@ method init*(self: Controller) =
self.events.on(SignalType.NodeStopped.event) do(e:Args): self.events.on(SignalType.NodeStopped.event) do(e:Args):
echo "-NEW-EVENT-- NodeStopped: ", repr(e) echo "-NEW-EVENT-- NodeStopped: ", repr(e)
self.events.emit("nodeStopped", Args()) self.events.emit("nodeStopped", Args())
self.accountsService.clear()
self.delegate.emitLogOut() self.delegate.emitLogOut()
self.events.on(SignalType.NodeReady.event) do(e:Args): self.events.on(SignalType.NodeReady.event) do(e:Args):

View File

@ -58,6 +58,12 @@ method init*(self: Service) =
except Exception as e: except Exception as e:
error "error: ", methodName="init", errName = e.name, errDesription = e.msg error "error: ", methodName="init", errName = e.name, errDesription = e.msg
method clear*(self: Service) =
self.generatedAccounts = @[]
self.loggedInAccount = AccountDto()
self.importedAccount = GeneratedAccountDto()
self.isFirstTimeAccountLogin = false
method validateMnemonic*(self: Service, mnemonic: string): string = method validateMnemonic*(self: Service, mnemonic: string): string =
try: try:
let response = status_go_general.validateMnemonic(mnemonic) let response = status_go_general.validateMnemonic(mnemonic)

View File

@ -49,3 +49,6 @@ method importMnemonic*(self: ServiceInterface, mnemonic: string): bool {.base.}
method login*(self: ServiceInterface, account: AccountDto, password: string): method login*(self: ServiceInterface, account: AccountDto, password: string):
string {.base.} = string {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method clear*(self: ServiceInterface) {.base.} =
raise newException(ValueError, "No implementation available")