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

Move password reset form to separate route, view #1390

Merged
merged 17 commits into from Jun 26, 2023

Conversation

alectrocute
Copy link
Contributor

@alectrocute alectrocute commented Jun 19, 2023

Hi Lemdevs!

Our password reset form has not the greatest UX at the moment. It appears like it's a link, but it's actually a button that takes the email field's value and resets the password upon click. There's also critical instructions hidden in a title attr. It just doesn't make much sense to me.

I propose we:

  • Move the password reset form to a new route.
Screenshot 2023-06-19 at 9 02 05 AM Screenshot 2023-06-19 at 9 02 07 AM

Translation PR to merge first:

LemmyNet/lemmy-translations#67

Thanks all!

@alectrocute
Copy link
Contributor Author

Just realized something: We also should redirect back to the login route on success.

@alectrocute
Copy link
Contributor Author

Made the changes. Accidentally started tracking lemmy-translations. How do I remove this from my PR? Also, should we git ignore this?

Copy link
Member

@SleeplessOne1917 SleeplessOne1917 left a comment

Choose a reason for hiding this comment

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

Besides my other comments, try using the latest version of the translations by running git submodule update --remote --recursive.

title={this.documentTitle}
path={this.context.router.route.match.url}
/>
<div className="row">
Copy link
Member

Choose a reason for hiding this comment

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

If there's only going to be one row, why not make the parent div have a className of container-lg row and get rid of this element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Primarily to make it match up with /login. I've refactored this in my upcoming changes.


loginResetForm() {
return (
<div>
Copy link
Member

Choose a reason for hiding this comment

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

Is this div necessary?

<h5>{capitalizeFirstLetter(i18n.t("forgot_password"))}</h5>

<div className="form-group row">
<label className="col-form-label col-sm-10">
Copy link
Member

Choose a reason for hiding this comment

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

Does this have to be a form-group with a label as a child? I typically think of label elements being associated with input elements.

Copy link
Member

Choose a reason for hiding this comment

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

Once the bootstrap 5 stuff gets merged shortly, it'll have to conform to the way it does form anyway, and might need changes.

</div>

<div className="form-group row">
<label
Copy link
Member

Choose a reason for hiding this comment

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

What would this label look like if it was a child of the same div as the input its for?

Copy link
Member

Choose a reason for hiding this comment

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

As long as it follows the bootstrap conventions, it should be okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would look like this @SleeplessOne1917

Screenshot 2023-06-20 at 3 20 42 PM

src/shared/components/home/login-reset.tsx Outdated Show resolved Hide resolved
@SleeplessOne1917
Copy link
Member

Also, this PR makes me wonder what the verify email page is for.

@alectrocute
Copy link
Contributor Author

alectrocute commented Jun 20, 2023

@SleeplessOne1917 I was thinking about this. Should we just make it part of the login page?

@SleeplessOne1917
Copy link
Member

@dessalines @Nutomic any input on this?

@alectrocute
Copy link
Contributor Author

Also, this PR makes me wonder what the verify email page is for.

It’s the page linked to in the password reset email.

@dessalines
Copy link
Member

VerifyEmail is when the back-end sends you an email with a token, that links to that verifyemail page. When you load it, it should send that token back to the server, confirming that you received the email and verified it.

<h5>{capitalizeFirstLetter(i18n.t("forgot_password"))}</h5>

<div className="form-group row">
<label className="col-form-label col-sm-10">
Copy link
Member

Choose a reason for hiding this comment

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

Once the bootstrap 5 stuff gets merged shortly, it'll have to conform to the way it does form anyway, and might need changes.

</div>

<div className="form-group row">
<label
Copy link
Member

Choose a reason for hiding this comment

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

As long as it follows the bootstrap conventions, it should be okay.

src/shared/components/home/login-reset.tsx Outdated Show resolved Hide resolved
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 115 to 136
handleEmailInputChange(i: LoginReset, event: any) {
i.setState(s => ((s.form.email = event.target.value.trim()), s));
}

async handlePasswordReset(i: LoginReset, event: any) {
event.preventDefault();

const email = i.state.form.email;

if (email && validEmail(email)) {
i.setState(s => ((s.form.loading = true), s));

const res = await HttpService.client.passwordReset({ email });

if (res.state == "success") {
toast(i18n.t("reset_password_mail_sent"));
i.context.router.history.push("/login");
}

i.setState(s => ((s.form.loading = false), s));
}
}
Copy link
Member

Choose a reason for hiding this comment

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

These can be defined at the module level instead of as class methods since they get this passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where would the module level be exactly, @SleeplessOne1917? In a @utils/app export? I'm sorry, still a bit of a Inferno noob.

Copy link
Member

Choose a reason for hiding this comment

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

I very much prefer the class methods even if this gets passed in, if only for organizations-sakes.

@dessalines
Copy link
Member

Once you get the conflicts handled we can merge this.

@alectrocute alectrocute requested a review from jsit as a code owner June 26, 2023 18:42
@alectrocute
Copy link
Contributor Author

@dessalines We should be good to go.

@alectrocute alectrocute added this to the 0.18.1 milestone Jun 26, 2023
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

Sweet, thx.

@dessalines dessalines merged commit 96cf021 into LemmyNet:main Jun 26, 2023
1 check was pending
jsit added a commit to jsit/lemmy-ui that referenced this pull request Jun 26, 2023
* lemmy/main:
  fix vote button alignment
  Fix feedback on banning an unbanning
  remove icon (LemmyNet#1618)
  Indicate valid and invalid fields in signup form (LemmyNet#1450)
  capitalize button (LemmyNet#1616)
  Move password reset form to separate route, view (LemmyNet#1390)
  feat(UI): Reduce base font size (LemmyNet#1591)
  Fix: missing semantic css classes and html elements (LemmyNet#1583)
jsit pushed a commit to jsit/lemmy-ui that referenced this pull request Jun 26, 2023
* rework password reset form

* make self-suggested changes

* cleaning

* validate in handlePasswordReset as well

* update submodule

* partially make suggested changes

* make suggested changes

* resolve merge conflicts

* resolve merge conflicts

* resolve merge conflicts

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
jsit pushed a commit to jsit/lemmy-ui that referenced this pull request Jun 27, 2023
* rework password reset form

* make self-suggested changes

* cleaning

* validate in handlePasswordReset as well

* update submodule

* partially make suggested changes

* make suggested changes

* resolve merge conflicts

* resolve merge conflicts

* resolve merge conflicts

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
jsit added a commit to jsit/lemmy-ui that referenced this pull request Jun 27, 2023
* lemmy/main:
  fix vote button alignment
  partially revert change
  Fix feedback on banning an unbanning
  remove icon (LemmyNet#1618)
  Indicate valid and invalid fields in signup form (LemmyNet#1450)
  capitalize button (LemmyNet#1616)
  Move password reset form to separate route, view (LemmyNet#1390)
  feat(UI): Reduce base font size (LemmyNet#1591)
  Fix: missing semantic css classes and html elements (LemmyNet#1583)
  remove hook entirely
  chore(DX): Add prettier to eslint config for use with editors
  fix bug collapsing previews when voting
  fix: Remove unnecessary string interpolations
  fix: Remove unnecessary class
  fix: Remove unnecessary classes
  fix: Restore removed classes
  fix: Remove wrapping li's
  fix: Remove extraneous classes
  fix: Move things back to where they were
  chore: Separate post mod buttons into functions
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.

None yet

3 participants