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

RFR: Create login/signup functionality #29

Merged
merged 29 commits into from
Oct 27, 2018
Merged

Conversation

josh-byster
Copy link
Contributor

@josh-byster josh-byster commented Oct 16, 2018

Status:

🚀 Ready

Deploy link

https://phillyreads-oogncirjbb.now.sh

Description

We would like to have working login and register pages integrating with the JWT from the backend. We would also like the page to be styled and easy-to-use.
Related issues: #4

Todos

Screenshots

screen shot 2018-10-22 at 11 02 02 pm

@josh-byster josh-byster self-assigned this Oct 16, 2018
@davidenwang davidenwang changed the title Create login/signup functionality WIP: Create login/signup functionality Oct 18, 2018
@josh-byster josh-byster force-pushed the jb/login_signup_revamp_16 branch 3 times, most recently from 213170b to 0720257 Compare October 23, 2018 03:47
@josh-byster josh-byster changed the title WIP: Create login/signup functionality RFR: Create login/signup functionality Oct 23, 2018
Copy link
Contributor

@XuanLi-Leong XuanLi-Leong left a comment

Choose a reason for hiding this comment

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

Here's my first pass! The only thing I didn't review in depth is the Login and Register render code. Thanks for the great work, and for considering lots of different cases and user flows.

frontend/src/App.js Outdated Show resolved Hide resolved
frontend/src/components/Logout.js Show resolved Hide resolved
frontend/src/components/PReadsNavbar.js Show resolved Hide resolved
frontend/src/pages/Home.js Outdated Show resolved Hide resolved
frontend/src/pages/KidsPage.js Outdated Show resolved Hide resolved
frontend/src/pages/Login.js Outdated Show resolved Hide resolved
frontend/src/pages/Login.js Outdated Show resolved Hide resolved
/>
</FormGroup>
<FormGroup>
{/* <Label for="password">Password</Label> */}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be commented out?

frontend/src/pages/Register.js Outdated Show resolved Hide resolved

getLoggedInMessage() {
if (this.state.isLoggedIn) {
return <Alert>You are logged in!</Alert>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should alert "You are registered and logged in!" instead of "logged in"

Copy link
Contributor

Choose a reason for hiding this comment

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

Although actually, I do wonder whether this message would be seen, if we're doing redirects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're definitely right - this was for us to mostly be able to visually debug the JWT storage to avoid having to go into DevTools every time. Now that we're redirecting, we can remove, but upon signup, should we display an alert that's like "welcome"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see 😄 Maybe for register, we can delay the redirect (using a timeout?). So it would be:

  • Make register request
  • Receive success response from BE, update cookie w JWT, start timeout of 1sec
  • Show a success state message, also mention you will be redirected in 1 second
  • Redirect occurs when timeout triggers

Copy link
Contributor

@XuanLi-Leong XuanLi-Leong left a comment

Choose a reason for hiding this comment

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

Reviewing the render content of Register and Login -- looks good, just change the text of the submit button

frontend/src/pages/Register.js Outdated Show resolved Hide resolved
frontend/src/pages/Login.js Outdated Show resolved Hide resolved
frontend/src/components/Login.js Outdated Show resolved Hide resolved
frontend/src/components/Login.js Show resolved Hide resolved
}
return this.state.errors.map(({ message, key }) => {
return <FormAlert key={key}>{message}</FormAlert>;
});
}

render() {
const message = this.getLoggedInMessage();
Copy link
Contributor

Choose a reason for hiding this comment

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

Style thing -- in the case of functions that return components, my practice has been to put the function inside render. That is:

render() {
  return (
    <div>
      {this.renderSomePart()}
    </div>
  );
}

super(props);
}
getColor() {
if (this.props.isRed) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do "isDanger" instead of "isRed" -- more meaning

frontend/src/components/Register.js Show resolved Hide resolved
frontend/src/components/Register.js Outdated Show resolved Hide resolved
@XuanLi-Leong
Copy link
Contributor

XuanLi-Leong commented Oct 25, 2018

Very small final changes and then we can merge it!

Copy link
Contributor

@XuanLi-Leong XuanLi-Leong left a comment

Choose a reason for hiding this comment

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

🚢 🚀 !! Thanks for the thoughtfulness and initiative 🙌

@josh-byster josh-byster merged commit a1eddfd into master Oct 27, 2018
@XuanLi-Leong XuanLi-Leong deleted the jb/login_signup_revamp_16 branch November 3, 2018 03:39
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