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
Move password reset form to separate route, view #1390
Conversation
Just realized something: We also should redirect back to the login route on success. |
…ctrocute/lemmy-ui into refactor-password-reset-form
Made the changes. Accidentally started tracking lemmy-translations. How do I remove this from my PR? Also, should we git ignore this? |
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 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"> |
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.
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?
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.
Primarily to make it match up with /login
. I've refactored this in my upcoming changes.
|
||
loginResetForm() { | ||
return ( | ||
<div> |
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.
Is this div necessary?
<h5>{capitalizeFirstLetter(i18n.t("forgot_password"))}</h5> | ||
|
||
<div className="form-group row"> | ||
<label className="col-form-label col-sm-10"> |
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.
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.
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.
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 |
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.
What would this label look like if it was a child of the same div as the input its for?
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.
As long as it follows the bootstrap conventions, it should be okay.
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.
It would look like this @SleeplessOne1917
Also, this PR makes me wonder what the verify email page is for. |
@SleeplessOne1917 I was thinking about this. Should we just make it part of the login page? |
@dessalines @Nutomic any input on this? |
It’s the page linked to in the password reset email. |
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"> |
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.
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 |
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.
As long as it follows the bootstrap conventions, it should be okay.
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.
LGTM
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)); | ||
} | ||
} |
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.
These can be defined at the module level instead of as class methods since they get this
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.
Where would the module level be exactly, @SleeplessOne1917? In a @utils/app
export? I'm sorry, still a bit of a Inferno noob.
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.
I very much prefer the class methods even if this
gets passed in, if only for organizations-sakes.
Once you get the conflicts handled we can merge this. |
@dessalines We should be good to go. |
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.
Sweet, thx.
* 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)
* 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>
* 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>
* 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
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:
Translation PR to merge first:
LemmyNet/lemmy-translations#67
Thanks all!