|
|
|
@ -194,15 +194,17 @@ private fun LoginForm(
@@ -194,15 +194,17 @@ private fun LoginForm(
|
|
|
|
|
.onTabOrEnterKeyFocusNext(focusManager) |
|
|
|
|
.testTag(TestTags.loginEmailUsername) |
|
|
|
|
.autofill(autofillTypes = listOf(AutofillType.Username), onFill = { |
|
|
|
|
loginFieldState = it |
|
|
|
|
eventSink(LoginPasswordEvents.SetLogin(it)) |
|
|
|
|
val sanitized = it.sanitize() |
|
|
|
|
loginFieldState = sanitized |
|
|
|
|
eventSink(LoginPasswordEvents.SetLogin(sanitized)) |
|
|
|
|
}), |
|
|
|
|
placeholder = { |
|
|
|
|
Text(text = stringResource(CommonStrings.common_username)) |
|
|
|
|
}, |
|
|
|
|
onValueChange = { |
|
|
|
|
loginFieldState = it |
|
|
|
|
eventSink(LoginPasswordEvents.SetLogin(it)) |
|
|
|
|
val sanitized = it.sanitize() |
|
|
|
|
loginFieldState = sanitized |
|
|
|
|
eventSink(LoginPasswordEvents.SetLogin(sanitized)) |
|
|
|
|
}, |
|
|
|
|
keyboardOptions = KeyboardOptions( |
|
|
|
|
keyboardType = KeyboardType.Email, |
|
|
|
@ -224,7 +226,6 @@ private fun LoginForm(
@@ -224,7 +226,6 @@ private fun LoginForm(
|
|
|
|
|
null |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var passwordVisible by remember { mutableStateOf(false) } |
|
|
|
|
if (state.loginAction is AsyncData.Loading) { |
|
|
|
|
// Ensure password is hidden when user submits the form |
|
|
|
@ -239,12 +240,14 @@ private fun LoginForm(
@@ -239,12 +240,14 @@ private fun LoginForm(
|
|
|
|
|
.onTabOrEnterKeyFocusNext(focusManager) |
|
|
|
|
.testTag(TestTags.loginPassword) |
|
|
|
|
.autofill(autofillTypes = listOf(AutofillType.Password), onFill = { |
|
|
|
|
passwordFieldState = it |
|
|
|
|
eventSink(LoginPasswordEvents.SetPassword(it)) |
|
|
|
|
val sanitized = it.sanitize() |
|
|
|
|
passwordFieldState = sanitized |
|
|
|
|
eventSink(LoginPasswordEvents.SetPassword(sanitized)) |
|
|
|
|
}), |
|
|
|
|
onValueChange = { |
|
|
|
|
passwordFieldState = it |
|
|
|
|
eventSink(LoginPasswordEvents.SetPassword(it)) |
|
|
|
|
val sanitized = it.sanitize() |
|
|
|
|
passwordFieldState = sanitized |
|
|
|
|
eventSink(LoginPasswordEvents.SetPassword(sanitized)) |
|
|
|
|
}, |
|
|
|
|
placeholder = { |
|
|
|
|
Text(text = stringResource(CommonStrings.common_password)) |
|
|
|
@ -272,6 +275,13 @@ private fun LoginForm(
@@ -272,6 +275,13 @@ private fun LoginForm(
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Ensure that the string does not contain any new line characters, which can happen when pasting values. |
|
|
|
|
*/ |
|
|
|
|
private fun String.sanitize(): String { |
|
|
|
|
return replace("\n", "") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
|
private fun LoginErrorDialog(error: Throwable, onDismiss: () -> Unit) { |
|
|
|
|
ErrorDialog( |
|
|
|
|