improvement(Login): Do not force 2FA code to be 6 symbols long

This commit is contained in:
Artem Chepurnoy 2024-10-21 10:53:17 +03:00
parent 7ef1648fb4
commit a9c369d7f4
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 4 additions and 4 deletions

View File

@ -272,10 +272,10 @@ private fun RememberStateFlowScope.createStateFlowForAuthenticator(
.map { rawCode ->
val code = rawCode
.trim()
if (code.length != 6) {
if (code.isEmpty()) {
Validated.Failure(
model = code,
error = translate(Res.string.error_must_have_exactly_n_symbols, 6),
error = translate(Res.string.error_must_not_be_blank),
)
} else {
Validated.Success(
@ -423,10 +423,10 @@ private fun RememberStateFlowScope.createStateFlowForEmail(
.map { rawCode ->
val code = rawCode
.trim()
if (code.length != 6) {
if (code.isEmpty()) {
Validated.Failure(
model = code,
error = translate(Res.string.error_must_have_exactly_n_symbols, 6),
error = translate(Res.string.error_must_not_be_blank),
)
} else {
Validated.Success(