fix(desktop/wallet): new account with error
This commit is contained in:
parent
da4d895131
commit
df670bfcbb
|
@ -25,17 +25,17 @@ method init*[T](self: Controller[T]) =
|
||||||
method getWalletAccounts*[T](self: Controller[T]): seq[wallet_account_service.WalletAccountDto] =
|
method getWalletAccounts*[T](self: Controller[T]): seq[wallet_account_service.WalletAccountDto] =
|
||||||
return self.walletAccountService.getWalletAccounts()
|
return self.walletAccountService.getWalletAccounts()
|
||||||
|
|
||||||
method generateNewAccount*[T](self: Controller[T], password: string, accountName: string, color: string) =
|
method generateNewAccount*[T](self: Controller[T], password: string, accountName: string, color: string): string =
|
||||||
self.walletAccountService.generateNewAccount(password, accountName, color)
|
return self.walletAccountService.generateNewAccount(password, accountName, color)
|
||||||
|
|
||||||
method addAccountsFromPrivateKey*[T](self: Controller[T], privateKey: string, password: string, accountName: string, color: string) =
|
method addAccountsFromPrivateKey*[T](self: Controller[T], privateKey: string, password: string, accountName: string, color: string): string =
|
||||||
self.walletAccountService.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
return self.walletAccountService.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
||||||
|
|
||||||
method addAccountsFromSeed*[T](self: Controller[T], seedPhrase: string, password: string, accountName: string, color: string) =
|
method addAccountsFromSeed*[T](self: Controller[T], seedPhrase: string, password: string, accountName: string, color: string): string =
|
||||||
self.walletAccountService.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
return self.walletAccountService.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
||||||
|
|
||||||
method addWatchOnlyAccount*[T](self: Controller[T], address: string, accountName: string, color: string) =
|
method addWatchOnlyAccount*[T](self: Controller[T], address: string, accountName: string, color: string): string =
|
||||||
self.walletAccountService.addWatchOnlyAccount(address, accountName, color)
|
return self.walletAccountService.addWatchOnlyAccount(address, accountName, color)
|
||||||
|
|
||||||
method deleteAccount*[T](self: Controller[T], address: string) =
|
method deleteAccount*[T](self: Controller[T], address: string) =
|
||||||
self.walletAccountService.deleteAccount(address)
|
self.walletAccountService.deleteAccount(address)
|
|
@ -13,16 +13,16 @@ method init*(self: AccessInterface) {.base.} =
|
||||||
method getWalletAccounts*(self: AccessInterface): seq[wallet_account_service.WalletAccountDto] {.base.} =
|
method getWalletAccounts*(self: AccessInterface): seq[wallet_account_service.WalletAccountDto] {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method generateNewAccount*(self: AccessInterface, password: string, accountName: string, color: string) {.base.} =
|
method generateNewAccount*(self: AccessInterface, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addAccountsFromPrivateKey*(self: AccessInterface, privateKey: string, password: string, accountName: string, color: string) {.base.} =
|
method addAccountsFromPrivateKey*(self: AccessInterface, privateKey: string, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addAccountsFromSeed*(self: AccessInterface, seedPhrase: string, password: string, accountName: string, color: string) {.base.} =
|
method addAccountsFromSeed*(self: AccessInterface, seedPhrase: string, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addWatchOnlyAccount*(self: AccessInterface, address: string, accountName: string, color: string) {.base.} =
|
method addWatchOnlyAccount*(self: AccessInterface, address: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
||||||
|
|
|
@ -11,16 +11,16 @@ method load*(self: AccessInterface) {.base.} =
|
||||||
method isLoaded*(self: AccessInterface): bool {.base.} =
|
method isLoaded*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method generateNewAccount*(self: AccessInterface, password: string, accountName: string, color: string) {.base.} =
|
method generateNewAccount*(self: AccessInterface, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addAccountsFromPrivateKey*(self: AccessInterface, privateKey: string, password: string, accountName: string, color: string) {.base.} =
|
method addAccountsFromPrivateKey*(self: AccessInterface, privateKey: string, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addAccountsFromSeed*(self: AccessInterface, seedPhrase: string, password: string, accountName: string, color: string) {.base.} =
|
method addAccountsFromSeed*(self: AccessInterface, seedPhrase: string, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addWatchOnlyAccount*(self: AccessInterface, address: string, accountName: string, color: string) {.base.} =
|
method addWatchOnlyAccount*(self: AccessInterface, address: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
||||||
|
|
|
@ -89,17 +89,17 @@ method load*[T](self: Module[T]) =
|
||||||
method isLoaded*[T](self: Module[T]): bool =
|
method isLoaded*[T](self: Module[T]): bool =
|
||||||
return self.moduleLoaded
|
return self.moduleLoaded
|
||||||
|
|
||||||
method generateNewAccount*[T](self: Module[T], password: string, accountName: string, color: string) =
|
method generateNewAccount*[T](self: Module[T], password: string, accountName: string, color: string): string =
|
||||||
self.controller.generateNewAccount(password, accountName, color)
|
return self.controller.generateNewAccount(password, accountName, color)
|
||||||
|
|
||||||
method addAccountsFromPrivateKey*[T](self: Module[T], privateKey: string, password: string, accountName: string, color: string) =
|
method addAccountsFromPrivateKey*[T](self: Module[T], privateKey: string, password: string, accountName: string, color: string): string =
|
||||||
self.controller.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
return self.controller.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
||||||
|
|
||||||
method addAccountsFromSeed*[T](self: Module[T], seedPhrase: string, password: string, accountName: string, color: string) =
|
method addAccountsFromSeed*[T](self: Module[T], seedPhrase: string, password: string, accountName: string, color: string): string =
|
||||||
self.controller.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
return self.controller.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
||||||
|
|
||||||
method addWatchOnlyAccount*[T](self: Module[T], address: string, accountName: string, color: string) =
|
method addWatchOnlyAccount*[T](self: Module[T], address: string, accountName: string, color: string): string =
|
||||||
self.controller.addWatchOnlyAccount(address, accountName, color)
|
return self.controller.addWatchOnlyAccount(address, accountName, color)
|
||||||
|
|
||||||
method deleteAccount*[T](self: Module[T], address: string) =
|
method deleteAccount*[T](self: Module[T], address: string) =
|
||||||
self.controller.deleteAccount(address)
|
self.controller.deleteAccount(address)
|
|
@ -35,17 +35,17 @@ QtObject:
|
||||||
proc setItems*(self: View, items: seq[Item]) =
|
proc setItems*(self: View, items: seq[Item]) =
|
||||||
self.model.setItems(items)
|
self.model.setItems(items)
|
||||||
|
|
||||||
proc generateNewAccount*(self: View, password: string, accountName: string, color: string) {.slot.} =
|
proc generateNewAccount*(self: View, password: string, accountName: string, color: string): string {.slot.} =
|
||||||
self.delegate.generateNewAccount(password, accountName, color)
|
return self.delegate.generateNewAccount(password, accountName, color)
|
||||||
|
|
||||||
proc addAccountsFromPrivateKey*(self: View, privateKey: string, password: string, accountName: string, color: string) {.slot.} =
|
proc addAccountsFromPrivateKey*(self: View, privateKey: string, password: string, accountName: string, color: string): string {.slot.} =
|
||||||
self.delegate.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
return self.delegate.addAccountsFromPrivateKey(privateKey, password, accountName, color)
|
||||||
|
|
||||||
proc addAccountsFromSeed*(self: View, seedPhrase: string, password: string, accountName: string, color: string) {.slot.} =
|
proc addAccountsFromSeed*(self: View, seedPhrase: string, password: string, accountName: string, color: string): string {.slot.} =
|
||||||
self.delegate.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
return self.delegate.addAccountsFromSeed(seedPhrase, password, accountName, color)
|
||||||
|
|
||||||
proc addWatchOnlyAccount*(self: View, address: string, accountName: string, color: string) {.slot.} =
|
proc addWatchOnlyAccount*(self: View, address: string, accountName: string, color: string): string {.slot.} =
|
||||||
self.delegate.addWatchOnlyAccount(address, accountName, color)
|
return self.delegate.addWatchOnlyAccount(address, accountName, color)
|
||||||
|
|
||||||
proc deleteAccount*(self: View, address: string) {.slot.} =
|
proc deleteAccount*(self: View, address: string) {.slot.} =
|
||||||
self.delegate.deleteAccount(address)
|
self.delegate.deleteAccount(address)
|
|
@ -207,42 +207,50 @@ method saveAccount(
|
||||||
walletIndex: int = 0,
|
walletIndex: int = 0,
|
||||||
id: string = "",
|
id: string = "",
|
||||||
publicKey: string = "",
|
publicKey: string = "",
|
||||||
) =
|
): string =
|
||||||
status_go_accounts.saveAccount(
|
try:
|
||||||
address,
|
status_go_accounts.saveAccount(
|
||||||
name,
|
address,
|
||||||
password,
|
name,
|
||||||
color,
|
password,
|
||||||
accountType,
|
color,
|
||||||
isADerivedAccount = true,
|
accountType,
|
||||||
walletIndex,
|
isADerivedAccount = true,
|
||||||
id,
|
walletIndex,
|
||||||
publicKey,
|
id,
|
||||||
)
|
publicKey,
|
||||||
let accounts = fetchAccounts()
|
)
|
||||||
let prices = self.fetchPrices()
|
let accounts = fetchAccounts()
|
||||||
|
let prices = self.fetchPrices()
|
||||||
|
|
||||||
var newAccount = accounts[0]
|
var newAccount = accounts[0]
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if not self.accounts.haskey(account.address):
|
if not self.accounts.haskey(account.address):
|
||||||
newAccount = account
|
newAccount = account
|
||||||
break
|
break
|
||||||
|
|
||||||
newAccount.tokens = self.buildTokens(newAccount, prices)
|
newAccount.tokens = self.buildTokens(newAccount, prices)
|
||||||
self.accounts[newAccount.address] = newAccount
|
self.accounts[newAccount.address] = newAccount
|
||||||
self.events.emit("walletAccount/accountSaved", AccountSaved(account: newAccount))
|
self.events.emit("walletAccount/accountSaved", AccountSaved(account: newAccount))
|
||||||
|
except Exception as e:
|
||||||
|
return fmt"Error adding new account: {e.msg}"
|
||||||
|
|
||||||
method generateNewAccount*(self: Service, password: string, accountName: string, color: string) =
|
method generateNewAccount*(self: Service, password: string, accountName: string, color: string): string =
|
||||||
let
|
let
|
||||||
setting = self.settingService.getSetting()
|
setting = self.settingService.getSetting()
|
||||||
walletRootAddress = setting.walletRootAddress
|
walletRootAddress = setting.walletRootAddress
|
||||||
walletIndex = setting.latestDerivedPath + 1
|
walletIndex = setting.latestDerivedPath + 1
|
||||||
|
defaultAccount = self.getDefaultAccount()
|
||||||
|
isPasswordOk = status_go_accounts.verifyAccountPassword(defaultAccount, password, KEYSTOREDIR)
|
||||||
|
|
||||||
|
if not isPasswordOk:
|
||||||
|
return "Error generating new account: invalid password"
|
||||||
|
|
||||||
let accountResponse = status_go_accounts.loadAccount(walletRootAddress, password)
|
let accountResponse = status_go_accounts.loadAccount(walletRootAddress, password)
|
||||||
let accountId = accountResponse.result{"id"}.getStr
|
let accountId = accountResponse.result{"id"}.getStr
|
||||||
let path = "m/" & $walletIndex
|
let path = "m/" & $walletIndex
|
||||||
let deriveResponse = status_go_accounts.deriveAccounts(accountId, @[path])
|
let deriveResponse = status_go_accounts.deriveAccounts(accountId, @[path])
|
||||||
self.saveAccount(
|
let errMsg = self.saveAccount(
|
||||||
deriveResponse.result[path]{"address"}.getStr,
|
deriveResponse.result[path]{"address"}.getStr,
|
||||||
accountName,
|
accountName,
|
||||||
password,
|
password,
|
||||||
|
@ -253,19 +261,22 @@ method generateNewAccount*(self: Service, password: string, accountName: string,
|
||||||
accountId,
|
accountId,
|
||||||
deriveResponse.result[path]{"publicKey"}.getStr
|
deriveResponse.result[path]{"publicKey"}.getStr
|
||||||
)
|
)
|
||||||
|
if errMsg != "":
|
||||||
|
return errMsg
|
||||||
|
|
||||||
discard self.settingService.saveSetting("latest-derived-path", walletIndex)
|
discard self.settingService.saveSetting("latest-derived-path", walletIndex)
|
||||||
|
return ""
|
||||||
|
|
||||||
method addAccountsFromPrivateKey*(self: Service, privateKey: string, password: string, accountName: string, color: string) =
|
method addAccountsFromPrivateKey*(self: Service, privateKey: string, password: string, accountName: string, color: string): string =
|
||||||
let
|
let
|
||||||
accountResponse = status_go_accounts.multiAccountImportPrivateKey(privateKey)
|
accountResponse = status_go_accounts.multiAccountImportPrivateKey(privateKey)
|
||||||
defaultAccount = self.getDefaultAccount()
|
defaultAccount = self.getDefaultAccount()
|
||||||
isPasswordOk = status_go_accounts.verifyAccountPassword(defaultAccount, password, KEYSTOREDIR)
|
isPasswordOk = status_go_accounts.verifyAccountPassword(defaultAccount, password, KEYSTOREDIR)
|
||||||
|
|
||||||
if not isPasswordOk:
|
if not isPasswordOk:
|
||||||
return
|
return "Error generating new account: invalid password"
|
||||||
|
|
||||||
self.saveAccount(
|
return self.saveAccount(
|
||||||
accountResponse.result{"address"}.getStr,
|
accountResponse.result{"address"}.getStr,
|
||||||
accountName,
|
accountName,
|
||||||
password,
|
password,
|
||||||
|
@ -277,7 +288,7 @@ method addAccountsFromPrivateKey*(self: Service, privateKey: string, password: s
|
||||||
accountResponse.result{"publicKey"}.getStr,
|
accountResponse.result{"publicKey"}.getStr,
|
||||||
)
|
)
|
||||||
|
|
||||||
method addAccountsFromSeed*(self: Service, seedPhrase: string, password: string, accountName: string, color: string) =
|
method addAccountsFromSeed*(self: Service, seedPhrase: string, password: string, accountName: string, color: string): string =
|
||||||
let mnemonic = replace(seedPhrase, ',', ' ')
|
let mnemonic = replace(seedPhrase, ',', ' ')
|
||||||
let paths = @[PATH_WALLET_ROOT, PATH_EIP_1581, PATH_WHISPER, PATH_DEFAULT_WALLET]
|
let paths = @[PATH_WALLET_ROOT, PATH_EIP_1581, PATH_WHISPER, PATH_DEFAULT_WALLET]
|
||||||
let accountResponse = status_go_accounts.multiAccountImportMnemonic(mnemonic)
|
let accountResponse = status_go_accounts.multiAccountImportMnemonic(mnemonic)
|
||||||
|
@ -289,9 +300,9 @@ method addAccountsFromSeed*(self: Service, seedPhrase: string, password: string,
|
||||||
isPasswordOk = status_go_accounts.verifyAccountPassword(defaultAccount, password, KEYSTOREDIR)
|
isPasswordOk = status_go_accounts.verifyAccountPassword(defaultAccount, password, KEYSTOREDIR)
|
||||||
|
|
||||||
if not isPasswordOk:
|
if not isPasswordOk:
|
||||||
return
|
return "Error generating new account: invalid password"
|
||||||
|
|
||||||
self.saveAccount(
|
return self.saveAccount(
|
||||||
deriveResponse.result[PATH_DEFAULT_WALLET]{"address"}.getStr,
|
deriveResponse.result[PATH_DEFAULT_WALLET]{"address"}.getStr,
|
||||||
accountName,
|
accountName,
|
||||||
password,
|
password,
|
||||||
|
@ -303,8 +314,8 @@ method addAccountsFromSeed*(self: Service, seedPhrase: string, password: string,
|
||||||
deriveResponse.result[PATH_DEFAULT_WALLET]{"publicKey"}.getStr
|
deriveResponse.result[PATH_DEFAULT_WALLET]{"publicKey"}.getStr
|
||||||
)
|
)
|
||||||
|
|
||||||
method addWatchOnlyAccount*(self: Service, address: string, accountName: string, color: string) =
|
method addWatchOnlyAccount*(self: Service, address: string, accountName: string, color: string): string =
|
||||||
self.saveAccount(address, accountName, "", color, status_go_accounts.WATCH, false)
|
return self.saveAccount(address, accountName, "", color, status_go_accounts.WATCH, false)
|
||||||
|
|
||||||
method deleteAccount*(self: Service, address: string) =
|
method deleteAccount*(self: Service, address: string) =
|
||||||
discard status_go_accounts.deleteAccount(address)
|
discard status_go_accounts.deleteAccount(address)
|
||||||
|
|
|
@ -24,16 +24,16 @@ method getWalletAccount*(self: ServiceInterface, accountIndex: int): WalletAccou
|
||||||
method getCurrencyBalance*(self: ServiceInterface): float64 {.base.} =
|
method getCurrencyBalance*(self: ServiceInterface): float64 {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method generateNewAccount*(self: ServiceInterface, password: string, accountName: string, color: string) {.base.} =
|
method generateNewAccount*(self: ServiceInterface, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addAccountsFromPrivateKey*(self: ServiceInterface, privateKey: string, password: string, accountName: string, color: string) {.base.} =
|
method addAccountsFromPrivateKey*(self: ServiceInterface, privateKey: string, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addAccountsFromSeed*(self: ServiceInterface, seedPhrase: string, password: string, accountName: string, color: string) {.base.} =
|
method addAccountsFromSeed*(self: ServiceInterface, seedPhrase: string, password: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addWatchOnlyAccount*(self: ServiceInterface, address: string, accountName: string, color: string) {.base.} =
|
method addWatchOnlyAccount*(self: ServiceInterface, address: string, accountName: string, color: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method deleteAccount*(self: ServiceInterface, address: string) {.base.} =
|
method deleteAccount*(self: ServiceInterface, address: string) {.base.} =
|
||||||
|
|
|
@ -139,17 +139,16 @@ ModalPopup {
|
||||||
return loading = false
|
return loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = RootStore.addAccountsFromPrivateKey(accountPKeyInput.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
|
const errMessage = RootStore.addAccountsFromPrivateKey(accountPKeyInput.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
|
||||||
|
|
||||||
loading = false
|
loading = false
|
||||||
if (result) {
|
if (errMessage) {
|
||||||
let resultJson = JSON.parse(result);
|
|
||||||
errorSound.play();
|
errorSound.play();
|
||||||
if (Utils.isInvalidPasswordMessage(resultJson.error)) {
|
if (Utils.isInvalidPasswordMessage(errMessage)) {
|
||||||
//% "Wrong password"
|
//% "Wrong password"
|
||||||
popup.passwordValidationError = qsTrId("wrong-password")
|
popup.passwordValidationError = qsTrId("wrong-password")
|
||||||
} else {
|
} else {
|
||||||
accountError.text = resultJson.error
|
accountError.text = errMessage
|
||||||
accountError.open()
|
accountError.open()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
@ -140,16 +140,15 @@ ModalPopup {
|
||||||
return loading = false
|
return loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = RootStore.addAccountsFromSeed(seedPhraseTextArea.textArea.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
|
const errMessage = RootStore.addAccountsFromSeed(seedPhraseTextArea.textArea.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
|
||||||
loading = false
|
loading = false
|
||||||
if (result) {
|
if (errMessage) {
|
||||||
let resultJson = JSON.parse(result);
|
|
||||||
errorSound.play();
|
errorSound.play();
|
||||||
if (Utils.isInvalidPasswordMessage(resultJson.error)) {
|
if (Utils.isInvalidPasswordMessage(errMessage)) {
|
||||||
//% "Wrong password"
|
//% "Wrong password"
|
||||||
popup.passwordValidationError = qsTrId("wrong-password")
|
popup.passwordValidationError = qsTrId("wrong-password")
|
||||||
} else {
|
} else {
|
||||||
accountError.text = resultJson.error
|
accountError.text = errMessage
|
||||||
accountError.open()
|
accountError.open()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
@ -112,16 +112,16 @@ ModalPopup {
|
||||||
return loading = false
|
return loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
|
const errMessage = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
|
||||||
|
console.log(errMessage)
|
||||||
loading = false
|
loading = false
|
||||||
if (result) {
|
if (errMessage) {
|
||||||
let resultJson = JSON.parse(result);
|
|
||||||
errorSound.play();
|
errorSound.play();
|
||||||
if (Utils.isInvalidPasswordMessage(resultJson.error)) {
|
if (Utils.isInvalidPasswordMessage(errMessage)) {
|
||||||
//% "Wrong password"
|
//% "Wrong password"
|
||||||
popup.passwordValidationError = qsTrId("wrong-password")
|
popup.passwordValidationError = qsTrId("wrong-password")
|
||||||
} else {
|
} else {
|
||||||
accountError.text = resultJson.error;
|
accountError.text = errMessage;
|
||||||
accountError.open();
|
accountError.open();
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue