Repository navigation
Fix: Resolve 'Invalid Email' on login after OTP signup #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| You are an elite open-source bounty hunter and senior software engineer. | ||
| Your task is to fix GitHub Issue #5 in the repository allknowledge34/UpdateApp. | ||
|
|
||
| Issue Title: $0.4 Bounty : Login fails with "Invalid Email" after successful signup and OTP verification | ||
| Issue Body: | ||
| --- | ||
| ### Description | ||
| After completing the signup process successfully, login does not work with the same email and password. | ||
| The app shows an **"Invalid Email"** error during login. | ||
|
|
||
| ### Signup Flow | ||
| 1. User signs up using: | ||
| - Name | ||
| - Phone number | ||
| - Password | ||
| 2. After signup, the app redirects to **phone number OTP verification** | ||
| 3. OTP is entered correctly and verified | ||
| 4. Account is created successfully | ||
|
|
||
| ### Issue | ||
| After logging out, when trying to log in using the **same email and password** used during signup, | ||
| the login fails and shows **"Invalid Email"** error. | ||
|
|
||
| ### Steps to Reproduce | ||
| 1. Open the app | ||
| 2. Go to Signup screen | ||
| 3. Enter name, email, phone number, and password | ||
| 4. Verify phone number using OTP | ||
| 5. Logout after successful signup | ||
| 6. Go to Login screen | ||
| 7. Enter the same email and password | ||
| 8. Login fails with "Invalid Email" error | ||
|
|
||
| ### Expected Behavior | ||
| User should be able to log in successfully using the same email and password after signup. | ||
|
|
||
| ### Actual Behavior | ||
| Login fails with "Invalid Email" error even though the account was created successfully. | ||
|
|
||
| ### Platform | ||
| - Java (Android) | ||
| - Email & Phone OTP Authentication | ||
|
|
||
| ### Additional Information | ||
| - OTP verification works correctly | ||
| - Signup flow completes without any error | ||
| - Issue happens only during login after signup | ||
|
|
||
| --- | ||
|
|
||
| Instructions: | ||
| 1. You are currently in the repository directory. | ||
| 2. Read the codebase to understand the context of the bug. | ||
| 3. Modify the code to fix the bug. | ||
| 4. Ensure the tests pass. | ||
| 5. Once you are 100% confident the fix is correct, run "git diff" to review your changes, but DO NOT commit or push yet. Just leave the code modified in the workspace. | ||
| 6. Reply with a summary of what you fixed and the root cause. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |||||
| import com.google.firebase.firestore.FirebaseFirestore; | ||||||
|
|
||||||
| import java.util.HashMap; | ||||||
| import java.util.Locale; | ||||||
| import java.util.Map; | ||||||
|
|
||||||
| public class LoginActivity extends AppCompatActivity { | ||||||
|
|
@@ -69,72 +70,10 @@ protected void onCreate(Bundle savedInstanceState) { | |||||
| progressDialog.setTitle(getString(R.string.logging_in)); | ||||||
| progressDialog.setMessage(getString(R.string.please_wait)); | ||||||
|
|
||||||
| binding.emailBtn.setOnClickListener(new View.OnClickListener() { | ||||||
| @Override | ||||||
| public void onClick(View view) { | ||||||
|
|
||||||
| String email = binding.edtEmail.getText().toString(); | ||||||
| String password = binding.edtPassword.getText().toString(); | ||||||
|
|
||||||
| if (email.isEmpty()) { | ||||||
| binding.edtEmail.setError(getString(R.string.enter_valid_email)); | ||||||
| } else if (password.isEmpty()) { | ||||||
| binding.edtPassword.setError(getString(R.string.enter_strong_password)); | ||||||
| } else { | ||||||
|
|
||||||
| progressDialog.show(); | ||||||
| auth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { | ||||||
| @Override | ||||||
| public void onComplete(@NonNull Task<AuthResult> task) { | ||||||
|
|
||||||
| if (task.isSuccessful()) { | ||||||
| progressDialog.dismiss(); | ||||||
| Intent intent = new Intent(LoginActivity.this, MainActivity.class); | ||||||
| startActivity(intent); | ||||||
| finish(); | ||||||
| } else { | ||||||
| progressDialog.dismiss(); | ||||||
| Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(), Toast.LENGTH_SHORT).show(); | ||||||
| } | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| binding.emailBtn.setOnClickListener(v -> performEmailLogin()); | ||||||
|
|
||||||
| binding.btnLogin.setOnClickListener(new View.OnClickListener() { | ||||||
| @Override | ||||||
| public void onClick(View v) { | ||||||
|
|
||||||
| String email = binding.edtEmail.getText().toString(); | ||||||
| String password = binding.edtPassword.getText().toString(); | ||||||
|
|
||||||
| if (email.isEmpty()) { | ||||||
| binding.edtEmail.setError(getString(R.string.enter_valid_email)); | ||||||
| } else if (password.isEmpty()) { | ||||||
| binding.edtPassword.setError(getString(R.string.enter_strong_password)); | ||||||
| } else { | ||||||
|
|
||||||
| progressDialog.show(); | ||||||
| auth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { | ||||||
| @Override | ||||||
| public void onComplete(@NonNull Task<AuthResult> task) { | ||||||
|
|
||||||
| if (task.isSuccessful()) { | ||||||
| progressDialog.dismiss(); | ||||||
| Intent intent = new Intent(LoginActivity.this, MainActivity.class); | ||||||
| startActivity(intent); | ||||||
| finish(); | ||||||
| } else { | ||||||
| progressDialog.dismiss(); | ||||||
| Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(), Toast.LENGTH_SHORT).show(); | ||||||
| } | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
| }); | ||||||
| binding.btnLogin.setOnClickListener(v -> performEmailLogin()); | ||||||
|
|
||||||
| binding.forgotPassword.setOnClickListener(new View.OnClickListener() { | ||||||
| @Override | ||||||
|
|
@@ -160,6 +99,32 @@ public void onClick(View v) { | |||||
| googleBtn.setOnClickListener(v -> signInWithGoogle()); | ||||||
| } | ||||||
|
|
||||||
| private void performEmailLogin() { | ||||||
| String email = binding.edtEmail.getText().toString().trim().toLowerCase(Locale.ROOT); | ||||||
| String password = binding.edtPassword.getText().toString(); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Password not trimmed — inconsistent with signup normalization.
🐛 Proposed fix- String password = binding.edtPassword.getText().toString();
+ String password = binding.edtPassword.getText().toString().trim();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| if (email.isEmpty()) { | ||||||
| binding.edtEmail.setError(getString(R.string.enter_valid_email)); | ||||||
| } else if (password.isEmpty()) { | ||||||
| binding.edtPassword.setError(getString(R.string.enter_strong_password)); | ||||||
| } else { | ||||||
| progressDialog.show(); | ||||||
| auth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { | ||||||
| @Override | ||||||
| public void onComplete(@NonNull Task<AuthResult> task) { | ||||||
| progressDialog.dismiss(); | ||||||
| if (task.isSuccessful()) { | ||||||
| Intent intent = new Intent(LoginActivity.this, MainActivity.class); | ||||||
| startActivity(intent); | ||||||
| finish(); | ||||||
| } else { | ||||||
| Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(), Toast.LENGTH_SHORT).show(); | ||||||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||||||
| } | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| void signInWithGoogle() { | ||||||
| Intent intent = gsc.getSignInIntent(); | ||||||
| startActivityForResult(intent, 1000); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove AI agent prompt artifact from the repository.
_hunter_prompt.txtis an internal task file generated for an automated bounty-hunter agent. It has no runtime role, exposes internal AI-assisted development tooling, and should be deleted before merging. Add it (and similar prompt files) to.gitignoreto prevent accidental future commits.🧰 Tools
🪛 LanguageTool
[grammar] ~29-~29: Ensure spelling is correct
Context: ...assword 4. Verify phone number using OTP 5. Logout after successful signup 6. Go to Login ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🤖 Prompt for AI Agents