mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
Prevent login using keyboard when homeserver is loading.
This commit is contained in:
@@ -66,10 +66,15 @@ struct AuthenticationLoginViewState: BindableState {
|
||||
!homeserver.ssoIdentityProviders.isEmpty
|
||||
}
|
||||
|
||||
/// `true` if it is possible to continue, otherwise `false`.
|
||||
/// `true` if the username and password are ready to be submitted.
|
||||
var hasValidCredentials: Bool {
|
||||
!bindings.username.isEmpty && !bindings.password.isEmpty
|
||||
}
|
||||
|
||||
/// `true` if valid credentials have been entered and the homeserver is loaded.
|
||||
var canSubmit: Bool {
|
||||
hasValidCredentials && !isLoading
|
||||
}
|
||||
}
|
||||
|
||||
struct AuthenticationLoginBindings {
|
||||
|
||||
@@ -127,7 +127,7 @@ struct AuthenticationLoginScreen: View {
|
||||
Text(VectorL10n.next)
|
||||
}
|
||||
.buttonStyle(PrimaryActionButtonStyle())
|
||||
.disabled(!viewModel.viewState.hasValidCredentials || viewModel.viewState.isLoading)
|
||||
.disabled(!viewModel.viewState.canSubmit)
|
||||
.accessibilityIdentifier("nextButton")
|
||||
}
|
||||
}
|
||||
@@ -166,9 +166,9 @@ struct AuthenticationLoginScreen: View {
|
||||
isPasswordFocused = false
|
||||
}
|
||||
|
||||
/// Sends the `next` view action so long as valid credentials have been input.
|
||||
/// Sends the `next` view action so long as the form is ready to submit.
|
||||
func submit() {
|
||||
guard viewModel.viewState.hasValidCredentials else { return }
|
||||
guard viewModel.viewState.canSubmit else { return }
|
||||
viewModel.send(viewAction: .next)
|
||||
}
|
||||
|
||||
|
||||
1
changelog.d/pr-6338.bugfix
Normal file
1
changelog.d/pr-6338.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Authentication: Don't attempt to login if the user presses the return key whilst loading a homeserver parsed from a username.
|
||||
Reference in New Issue
Block a user