Skip to content
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

UNT-T21169 - Bugfix Login Issue #2

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

priyanshu-simformsolutions
Copy link
Owner

@priyanshu-simformsolutions priyanshu-simformsolutions commented Jan 8, 2024

UNT-T21169 - Day4 - Bugfix/Login - ForgotPassword Issue

Fix:

  • Login Screen Forgot Password Button Click not working
  • Fix Login Screen Password Check for Email and Password

Add:

  • Validator.kt to perform Validations

@priyanshu-simformsolutions priyanshu-simformsolutions marked this pull request as ready for review January 8, 2024 14:03
Copy link
Collaborator

@nishchal-v nishchal-v left a comment

Choose a reason for hiding this comment

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

Please add some validation logic to mimic real bug fix scenario

@priyanshu-simformsolutions priyanshu-simformsolutions force-pushed the bugfix/login_issue branch 2 times, most recently from 4c15166 to 09e2593 Compare January 9, 2024 08:34
}

fun isValidEmail(email: String) =
email.isNotEmpty() && android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
Copy link
Collaborator

Choose a reason for hiding this comment

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

android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
Would already fail if email is empty, or not?

Copy link
Owner Author

Choose a reason for hiding this comment

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

yes, it fails in Pattern Matcher

VALID, INVALID_EMAIL, INVALID_PASSWORD
}

fun isValidLogin(email: String, password: String): ValidLogin {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Function name should have meaningful name
Are we authenticating the login?

As per my point of view, we are validating the login credential feilds.

Copy link
Owner Author

Choose a reason for hiding this comment

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

okay i have changed the name accordingly

@priyanshu-simformsolutions priyanshu-simformsolutions force-pushed the bugfix/login_issue branch 2 times, most recently from a8c168b to 90a91f7 Compare January 10, 2024 07:40
}

fun isValidCredentials(email: String, password: String): ValidCredentials {
return if (isValidEmail(email)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Simplify the return using guard statements

fun isValidCredentials(email: String, password: String): String {
if (!isValidEmail(email)) return ValidCredentials.INVALID_EMAIL
if (!isValidPassword(email)) return ValidCredentials.INVALID_PASSWORD
...
}

Copy link
Owner Author

Choose a reason for hiding this comment

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

okay will follow it

Fix Forgot Password Click not working
Fix Login Screen Password Check

Add Validator.kt to perform Validations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants