Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -73,8 +73,8 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onClick(View view) {

String email = binding.edtEmail.getText().toString();
String password = binding.edtPassword.getText().toString();
String email = binding.edtEmail.getText().toString().trim().toLowerCase();
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

String.toLowerCase() without an explicit Locale uses the device default locale, which can produce incorrect results for certain locales (e.g., Turkish i/I) and break email matching. Use toLowerCase(Locale.ROOT) (and add the corresponding import) for locale-independent normalization.

Copilot uses AI. Check for mistakes.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
String password = binding.edtPassword.getText().toString().trim();
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

Trimming the password changes the credentials the user enters and can break login for existing accounts that were created with leading/trailing spaces (previously those spaces were preserved). Avoid mutating the password; instead validate and show an error if it has unintended whitespace.

Copilot uses AI. Check for mistakes.

if (email.isEmpty()) {
binding.edtEmail.setError(getString(R.string.enter_valid_email));
Expand Down Expand Up @@ -107,8 +107,8 @@ public void onComplete(@NonNull Task<AuthResult> task) {
@Override
public void onClick(View v) {

String email = binding.edtEmail.getText().toString();
String password = binding.edtPassword.getText().toString();
String email = binding.edtEmail.getText().toString().trim().toLowerCase();
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

String.toLowerCase() should specify a fixed Locale (e.g., Locale.ROOT) to avoid locale-dependent behavior on devices set to Turkish/other special locales, which can cause email normalization mismatches.

Copilot uses AI. Check for mistakes.
String password = binding.edtPassword.getText().toString().trim();
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

Same as above: trimming the password can prevent sign-in for users whose actual password includes leading/trailing spaces. Keep the password string unchanged and handle accidental whitespace via validation/UI messaging instead.

Copilot uses AI. Check for mistakes.

if (email.isEmpty()) {
binding.edtEmail.setError(getString(R.string.enter_valid_email));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ protected void onCreate(Bundle savedInstanceState) {

private void doValidation() {

String name = binding.edtName.getText().toString();
String email = binding.edtEmail.getText().toString();
String number = binding.edtMobile.getText().toString();
String password = binding.edtPassword.getText().toString();
String name = binding.edtName.getText().toString().trim();
String email = binding.edtEmail.getText().toString().trim().toLowerCase();
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

toLowerCase() here is locale-dependent; use toLowerCase(Locale.ROOT) to ensure email normalization is stable across device locales.

Copilot uses AI. Check for mistakes.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
String number = binding.edtMobile.getText().toString().trim();
String password = binding.edtPassword.getText().toString().trim();
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

Trimming the password at signup changes what the user entered and can be surprising/inconsistent with Firebase Auth semantics (spaces are valid password characters). Also, combined with trimming in login it can lock out existing users who previously signed up with trailing/leading spaces. Prefer leaving the password as-is and validating against accidental whitespace instead.

Copilot uses AI. Check for mistakes.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

if (name.isEmpty()) { binding.edtName.setError(getString(R.string.enter_good_name)); return; }
if (email.isEmpty()) { binding.edtEmail.setError(getString(R.string.enter_valid_email)); return; }
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
android:textSize="16sp"
android:textColor="#A2A4b5"
android:ems="10"
android:inputType="textPersonName"
android:inputType="textEmailAddress"
android:background="@drawable/background_edit" />

<TextView
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_sign_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
android:textSize="16sp"
android:textColor="#A2A4b5"
android:ems="10"
android:inputType="textPersonName"
android:inputType="textEmailAddress"
android:background="@drawable/background_edit" />

<TextView
Expand All @@ -123,7 +123,7 @@
android:textSize="16sp"
android:textColor="#A2A4b5"
android:ems="10"
android:inputType="textPhonetic"
android:inputType="phone"
android:background="@drawable/background_edit" />

<TextView
Expand Down
Loading