Disable login button when password is blank (#441)

This commit is contained in:
Caleb Derosier
2023-12-28 10:49:15 -06:00
committed by Álison Fernandes
parent 492038f163
commit e92c85005b
2 changed files with 50 additions and 13 deletions

View File

@@ -42,7 +42,7 @@ class LoginViewModel @Inject constructor(
initialState = savedStateHandle[KEY_STATE]
?: LoginState(
emailAddress = LoginArgs(savedStateHandle).emailAddress,
isLoginButtonEnabled = true,
isLoginButtonEnabled = false,
passwordInput = "",
environmentLabel = environmentRepository.environment.label,
loadingDialogState = LoadingDialogState.Hidden,
@@ -208,7 +208,12 @@ class LoginViewModel @Inject constructor(
}
private fun handlePasswordInputChanged(action: LoginAction.PasswordInputChanged) {
mutableStateFlow.update { it.copy(passwordInput = action.input) }
mutableStateFlow.update {
it.copy(
passwordInput = action.input,
isLoginButtonEnabled = action.input.isNotBlank(),
)
}
}
}