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

[auth] Styled and implemented forgotPassword screen #60

Merged
merged 14 commits into from
Mar 13, 2024

Conversation

kylezryr
Copy link
Contributor

@kylezryr kylezryr commented Mar 1, 2024

What's new in this PR

  • Styled forgotPassword screen to include a header, input for email or username, subtext, error messages if username/email isn't found, and button that routes to signUp page
  • Error messages display until error is solved
  • Button is disabled until email/username is valid

Relevant Links

Notion Sprint Task

Sprint Page

Online sources

Mutex documentation

Related PRs

How to review

  • Create an account/use an existing one
  • Go to forgot password screen, attempt entering account's username/email
  • Check that error message displays and "Continue" button is disabled until email/username is valid
  • Check that "Continue" button routes you to the sign up page

Next steps

Tests Performed, Edge Cases

  • Created new account and went through forgot password flow, managed to successfully reset password
  • Tried entering invalid emails and usernames, error messages are working

Screenshots

IMG_2470
IMG_2471
IMG_2472
IMG_2473

CC: @adityapawar1

@kylezryr kylezryr marked this pull request as ready for review March 1, 2024 21:01
Copy link
Collaborator

@adityapawar1 adityapawar1 left a comment

Choose a reason for hiding this comment

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

bro reading your code is so readable keep it up. couple of small bugs to fix!


subtext: {
paddingVertical: 18,
color: '#797979',
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can replace with with colors.darkGrey (from styles/colors.tsx) just to keep everything standardized.

<Text style={[globalStyles.h1]}>Forgot Password?</Text>
<UserStringInput
placeholder="Email or account username"
placeholderTextColor="#797979"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can replace with with colors.darkGrey (from styles/colors.tsx).

src/app/auth/forgotPassword/index.tsx Outdated Show resolved Hide resolved
leftIcon={{ type: 'font-awesome', name: 'envelope' }}
onChangeText={text => setEmail(text)}
<View>
<Text style={[globalStyles.h1]}>Forgot Password?</Text>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you need to add a paddingBottom of 8 here based on the designs

@kylezryr kylezryr requested a review from adityapawar1 March 3, 2024 21:56
Copy link
Collaborator

@adityapawar1 adityapawar1 left a comment

Choose a reason for hiding this comment

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

couple things i forgot the first pass of the review

src/app/auth/forgotPassword/index.tsx Show resolved Hide resolved
const { error } = await verifyOtp(email, verificationCode);
const setAndCheckEmailOrUsername = async (newEmail: string) => {
setEmail(newEmail);
const release = await mutex.current.acquire();
Copy link
Collaborator

Choose a reason for hiding this comment

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

So I found a much better way to fix this issue (sorry about making you implement the mutex, but this makes the code a lot easier to understand). Using this library (https://github.com/xnimorz/use-debounce?tab=readme-ov-file), we can debounce a value. This means the state will only update when the user stops updating the text field (aka, stops typing). So we only need to run database requests whenever the user stops typing and not everytime the text box updates. It should be really easy to implement and you can play around with what you want the debounce value to be.

@kylezryr kylezryr requested a review from adityapawar1 March 11, 2024 18:36
@adityapawar1 adityapawar1 merged commit 14567de into main Mar 13, 2024
2 checks passed
@adityapawar1 adityapawar1 deleted the kyle/styleForgotPassword branch March 13, 2024 06:43
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