Skip to content

Commit

Permalink
Arreglados mensajes de excepción en el inicio de sesión y registro
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelMH1 committed Jan 10, 2024
1 parent ff541a0 commit 24e287a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import android.text.TextWatcher
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.example.saveup.view.MainActivity
import com.example.saveup.R
import com.example.saveup.databinding.ActivityLoginBinding
import com.example.saveup.view.MainActivity
import com.google.android.material.textfield.TextInputLayout
import com.google.firebase.auth.FirebaseAuth

Expand Down Expand Up @@ -52,7 +52,11 @@ class LoginActivity : AppCompatActivity() {
finish()
} else {
enableForm(true)
Toast.makeText(this, it.exception.toString(), Toast.LENGTH_LONG).show()
Toast.makeText(
this,
it.exception?.message ?: resources.getString(R.string.errLoggingIn),
Toast.LENGTH_LONG
).show()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ class SignUpActivity : AppCompatActivity() {
viewModel.saveUserInFirestore(it.result.user)
} else {
enableForm(true)
Toast.makeText(this, it.exception.toString(), Toast.LENGTH_LONG).show()
Toast.makeText(
this,
it.exception?.message ?: resources.getString(R.string.errLoggingIn),
Toast.LENGTH_LONG
).show()
}
}
}
Expand All @@ -82,7 +86,7 @@ class SignUpActivity : AppCompatActivity() {
binding.outlinedTextFieldEmail.error = resources.getString(R.string.errCampoVacio)
etFocus = binding.etEmail
}
val minLen = 4
val minLen = 6
if (password.length < minLen) {
binding.outlinedTextFieldPassword.error =
resources.getString(R.string.errMinLengthPassword, minLen)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
<string name="infoCreatedUser">Se ha creado el usuario</string>
<string name="errMismatchingPasswords">Las contraseñas no coinciden</string>
<string name="errMinLengthPassword">Tiene que tener al menos %1$d carácteres</string>
<string name="errSigningUp">Error al crear la cuenta</string>
<string name="infoLoggedOut">Se ha cerrado la sesión</string>
<string name="infoLoggedIn">Se ha iniciado sesión</string>
<string name="errLoggingIn">Error al iniciar sesión</string>
<string name="titleGrupos">Mis grupos</string>
<string name="addgroup">addGroup</string>
<string name="stringBudget">Presupuesto</string>
Expand Down

0 comments on commit 24e287a

Please sign in to comment.