fix(Onboarding): don't push the splash before checking the credentials

- we want to display the credential errors in-place
- define a new signal `accountLoginSuccess()` in NIM, and use it to
signal QML that we can proceed with showing the splash screen
- adjust SB to simulate the behavior we have in main.qml
This commit is contained in:
Lukáš Tinkl 2025-02-20 17:07:41 +01:00
parent f9bda5ced4
commit 9847f9fa4d
No known key found for this signature in database
5 changed files with 18 additions and 8 deletions

View File

@ -264,12 +264,14 @@ method onNodeLogin*[T](self: Module[T], err: string, account: AccountDto, settin
let err2 = self.delegate.userLoggedIn()
if err2.len != 0:
error "error from userLoggedIn", err2
self.onAccountLoginError(err2)
return
if self.localPairingStatus != nil and self.localPairingStatus.installation != nil and self.localPairingStatus.installation.id != "":
# We tried to login by pairing, so finilize the process
self.controller.finishPairingThroughSeedPhraseProcess(self.localPairingStatus.installation.id)
self.view.accountLoginSuccess()
self.finishAppLoading2()
method onLocalPairingStatusUpdate*[T](self: Module[T], status: LocalPairingStatus) =

View File

@ -36,6 +36,7 @@ QtObject:
proc appLoaded*(self: View) {.signal.}
proc accountLoginError*(self: View, error: string, wrongPassword: bool) {.signal.}
proc accountLoginSuccess*(self: View) {.signal.}
### QtProperties ###

View File

@ -164,14 +164,18 @@ SplitView {
logs.logEvent("OnboardingStore.inputConnectionStringForBootstrapping", ["connectionString"], arguments)
}
// password signals
// login result signals
signal accountLoginError(string error, bool wrongPassword)
// (test) error handler
onAccountLoginError: function (error, wrongPassword) {
ctrlLoginResult.result = "<font color='red'>⛔</font>"
onboarding.unwindToLoginScreen()
}
signal accountLoginSuccess()
onAccountLoginSuccess: {
ctrlLoginResult.result = "<font color='green'>✔</font>"
onboarding.stack.push(splashScreen, { runningProgressAnimation: true })
}
}
biometricsAvailable: ctrlBiometrics.checked
@ -204,8 +208,7 @@ SplitView {
onboardingStore.accountLoginError("", true)
ctrlLoginResult.result = "<font color='red'>⛔</font>"
} else {
ctrlLoginResult.result = "<font color='green'>✔</font>"
stack.push(splashScreen, { runningProgressAnimation: true })
onboardingStore.accountLoginSuccess()
}
}

View File

@ -9,6 +9,9 @@ QtObject {
signal appLoaded
signal accountLoginSuccess()
signal accountLoginError(string error, bool wrongPassword)
readonly property QtObject d: StatusQUtils.QObject {
id: d
readonly property var onboardingModuleInst: onboardingModule
@ -16,6 +19,7 @@ QtObject {
Component.onCompleted: {
d.onboardingModuleInst.appLoaded.connect(root.appLoaded)
d.onboardingModuleInst.accountLoginError.connect(root.accountLoginError)
d.onboardingModuleInst.accountLoginSuccess.connect(root.accountLoginSuccess)
}
}
@ -62,8 +66,6 @@ QtObject {
}
// password
signal accountLoginError(string error, bool wrongPassword)
function getPasswordStrengthScore(password: string) { // -> int
return d.onboardingModuleInst.getPasswordStrengthScore(password, "") // The second argument is username
}

View File

@ -480,7 +480,6 @@ StatusWindow {
}
onLoginRequested: function (keyUid, method, data) {
stack.push(splashScreenV2, { runningProgressAnimation: true })
onboardingStore.loginRequested(keyUid, method, data)
}
@ -499,6 +498,9 @@ StatusWindow {
applicationWindow.storeAppState()
moveToAppMain()
}
onAccountLoginSuccess: {
stack.push(splashScreenV2, { runningProgressAnimation: true })
}
onAccountLoginError: function (error, wrongPassword) {
onboardingLayout.unwindToLoginScreen() // error handled internally
}