-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sign-up Page Functionality #202
Conversation
Visit the preview URL for this PR (updated for commit fb2dcf3): https://blueprintsupportivehousing--pr202-kevin-signup-functio-hto1ingq.web.app (expires Thu, 30 Nov 2023 01:34:28 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f6bcdba7452bf82a6ec1a299c37d1bdff7870d09 |
@@ -3,6 +3,7 @@ | |||
InvalidPasswordException, |
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.
Not sure if this needs to be addressed in this PR, but I was trying to sign up with an account that is "Invited" but clicking "Create Account" didn't do anything. I looked in the networks tab and found that the register endpoint failed with the error: "Invalid password string. Password must be a string at least 6 characters long." This could be unintuitive for the users since it didn't show an error box so they don't know that this password character limit exists.
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.
Resolved ; I approached this by offloading the password verification to the frontend (by simply doing a length check to verify the password is >= 6 characters long). This check is performed both in the onClick handler for createAccount and within the handlePasswordChange function (which functions the same way as the valid email error does, in which we only check for the validity of these fields after the create account button has been clicked)
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.
Besides the comment I left, everything else looks good and works well!
JSON.stringify(authUser), | ||
); | ||
setAuthenticatedUser(authUser); | ||
if (isInvited !== "Not Invited") { |
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.
The above check would trigger as long as some string was being returned here (which this function always did, even in the error case) hence we just changed the logic around
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.
Could you explain what you mean by this? Do you mean that it would show not invited even if an invalid string was passed in?
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.
Basically, before the condition was simply if (isInvited)
. However, the function call was returning (even in the error case) the string Not Invited
. This meant that, even when we were supposed to be erroring out, we were interpreting the API call as successful since if (isInvited)
would be true if the string was not empty
export const getAuthErrMessage = (axiosErrRes: AxiosError["response"], flow: AuthFlow): string => { | ||
if (axiosErrRes && axiosErrRes.data && axiosErrRes.data.error) { | ||
return axiosErrRes.data.error; | ||
} | ||
return `Error ${flow === 'LOGIN' ? "logging in" : "signing up"}. Please try again later.`; | ||
} |
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.
Takes in the auth flow (either 'LOGIN' or 'SIGNUP') from which we're accessing this method, as to consolidate the two functiosn we had before into one
const isLoginErrorResponse = ( | ||
res: AuthTokenResponse | ErrorResponse, | ||
): res is ErrorResponse => { | ||
return res !== null && "errCode" in res; | ||
}; | ||
|
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.
Added a more comprehensive version of this function isAuthErrorResponse
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.
muy bien
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.
Looks good, and it works as expected. Only thing that I kind of struggled to understand was one of your comments
Notion task link
Signup Page Functionality
Implementation description
Signup.tsx
file)Signup.tsx
form to use Chakra built-in componentsSteps to test
Invalid email
testatshouldnotwork.com
)User Not Invited
Email Already in Use
Active
accountGeneral
What should reviewers focus on?
Checklist