Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(binding.getRoot());

auth = FirebaseAuth.getInstance();

// Handle prefilled email from OTPActivity redirect
String prefilledEmail = getIntent().getStringExtra("prefilled_email");
if (prefilledEmail != null && !prefilledEmail.isEmpty()) {
binding.edtEmail.setText(prefilledEmail);
}

googleBtn = findViewById(R.id.google_btn);
emailBtn = findViewById(R.id.email_btn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,16 @@ private void verifyCredential(PhoneAuthCredential credential) {
String msg = e != null ? e.getMessage() : "Unknown linking error";

if (e instanceof FirebaseAuthUserCollisionException) {
// Email already exists with different account.
// Sign out this phone-only account and redirect to login with existing email.
auth.signOut();
Toast.makeText(OTPActivity.this,
"This email is already registered with a different account. Please login with that email or use another email.",
"An account with this email already exists. Please login with your email and password.",
Toast.LENGTH_LONG).show();
Comment on lines 192 to 194
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Move the collision toast into strings.xml.

This new message is hardcoded in English, so the recovery path bypasses the app's locale handling and will not be translated.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/example/updateapp/views/activites/OTPActivity.java`
around lines 192 - 194, The hardcoded English toast in OTPActivity (the
Toast.makeText call) must be moved to strings.xml: add a new localized string
resource (e.g., name it error_account_exists with the message "An account with
this email already exists. Please login with your email and password."), then
replace the hardcoded text in OTPActivity's Toast.makeText with
getString(R.string.error_account_exists) (or context.getString(...)) so the
message uses Android's localization system. Ensure you update any import/usages
if needed and run a quick strings.xml merge for other locales.

Intent intent = new Intent(OTPActivity.this, LoginActivity.class);
intent.putExtra("prefilled_email", email);
startActivity(intent);
finish();
} else {
Toast.makeText(OTPActivity.this,
"Failed to link email: " + msg,
Expand Down