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

user settings: directly send password reset email #11517

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ss62171
Copy link
Collaborator

@ss62171 ss62171 commented Feb 10, 2019

This sends a password reset link to the user's current email
instead of redirecting them to another page.
An option to resend the link is also added.

Fixes: #6342

GIFs or Screenshots:

ezgif com-video-to-gif

@zulipbot
Copy link
Member

Hello @zulip/server-settings members, this pull request was labeled with the "area: settings (user)" label, so you may want to check it out!

@ss62171 ss62171 force-pushed the password_reset branch 2 times, most recently from 48fe402 to 206bf63 Compare February 10, 2019 20:38
@ss62171
Copy link
Collaborator Author

ss62171 commented Feb 10, 2019

This is open for review :)

@rishig
Copy link
Member

rishig commented Feb 11, 2019

Thanks! One more place the password thing appears is under Show/Change your API key.

Also a quick change I would make is to put "Check your email" and "Resend" on the same line, maybe like "Check your email (resend)", or "Check your email | Resend email".

The "Check your email" can be in green; the same color we use for other success messages.

@ss62171
Copy link
Collaborator Author

ss62171 commented Feb 11, 2019

@rishig is this fine now?

@rishig
Copy link
Member

rishig commented Feb 11, 2019

could you send another screencast of the interaction in settings? The first one you sent was very helpful, thanks :).

@ss62171
Copy link
Collaborator Author

ss62171 commented Feb 11, 2019

@rishig here it is :)

feb1220192_44am

@ss62171
Copy link
Collaborator Author

ss62171 commented Feb 11, 2019

Actually quality of this gif is not good due to its size.

@rishig
Copy link
Member

rishig commented Feb 11, 2019

Great, thanks! I do think it should be "Check your email (Resend)" rather than the other way around, but I'll let Tim decide that when merging.

There's a minor issue of there being a flash of something when you click "Reset password" in the API section; do you know what that is?

@ss62171
Copy link
Collaborator Author

ss62171 commented Feb 11, 2019

It's just text saying "sending..."

@timabbott
Copy link
Sponsor Member

@shubhamdhama @pragatiagrawal31 can you help review this?

@rishig
Copy link
Member

rishig commented Feb 11, 2019

Got it. Let's just use the same inline loading indicator here as well.

@ss62171
Copy link
Collaborator Author

ss62171 commented Feb 11, 2019

any other changes needed??

<a class="sea-green" reset_password_container id="reset_password" style="display: none">{{t "Reset password" }}</a>
<div class="loading_indicator_spinner"></div>
<a class="sea-green reset_password_container" id="resend_link">{{t "Resend" }}</a>
<span id="email_text" style="display: none">{{t "(Check your email)" }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

I was being told that we don't use inline CSS in templates, so here, instead, you can use Bootstrap classes .show & .hide for controlling the display.

<a class="sea-green" id="api_forgot_password" target="_blank">{{t "Never had one? Forgotten it?" }}</a>
<a class="sea-green reset_password_container" id="api_reset_password" style="display: none">{{t "Reset password" }}</a>
<a class="sea-green reset_password_container" id="api_resend_link">{{t "Resend" }}</a>
<span id="api_email_text" style="display: none">{{t "(Check your email)" }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Here too we can use Bootstrap class .hide.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I can see a lot of repetition of code here, so can you please try to de-duplicate some code.

@@ -209,16 +209,64 @@ exports.set_up = function () {
$("#show_api_key_box").hide();
$("#api_key_button_box").show();

function show_reset_email_loader() {
loading.make_indicator($(".loading_indicator_spinner"), {text: 'Sending...'});
Copy link
Member

Choose a reason for hiding this comment

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

This should be marked for translation. You should use the internationalization library i18n as i18n.t("Sending...")

Copy link
Member

Choose a reason for hiding this comment

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

Yep strings marked with i18n.t function is marked for translation.

@pragatiagrawal31
Copy link
Member

I've tested this locally and it works fine.

margin-top: 0;
}

#account-settings #change_password_modal .reset_password_container {
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 necessary? Use .hide instead!!

$('#api_forgot_password').show();
$('#api_reset_password').hide();
$('#api_resend_link').hide();
$('#api_email_text').hide();
Copy link
Member

Choose a reason for hiding this comment

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

I'm always not sure about using hide and show on many selectors, it would be great if possible we can use some class and apply hide and show on that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried using class but it didn't work out

Copy link
Member

Choose a reason for hiding this comment

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

Can you please elaborate on how the class didn't work out, I mean what's the problem with that approach, and if doesn't work out it's fine too.

Copy link
Collaborator Author

@ss62171 ss62171 Mar 4, 2019

Choose a reason for hiding this comment

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

@shubhamdhama can I use seperate class for every selector?

This sends a password reset link to the user's current email
instead of redirecting them to another page.
An option to resend the link is also added.

Fixes: zulip#6342

Fixes error of lint

user_settinngs: Directly send password reset mail.

user_settings: Fixes lint error.

Fix inline CSS
Fix for translation
Use hide instead of "display: none"
@@ -209,16 +209,64 @@ exports.set_up = function () {
$("#show_api_key_box").hide();
$("#api_key_button_box").show();

function show_reset_email_loader() {
loading.make_indicator($(".loading_indicator_spinner"), {text: i18n.t("Sending...")});
Copy link
Member

Choose a reason for hiding this comment

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

I think we shouldn't use Sending .., and just use the loading indicator.

<a class="sea-green" id="api_forgot_password" target="_blank">{{t "Never had one? Forgotten it?" }}</a>
<a class="sea-green reset_password_container" id="api_reset_password" style="display: none">{{t "Reset password" }}</a>
<a class="sea-green reset_password_container" id="api_resend_link">{{t "Resend" }}</a>
<span id="api_email_text">{{t "(Check your email)" }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Regarding my remove duplicate comment, you can try using partials otherwise left it, for now, Tim will tell whether it's worth to use partials here or not.

@zulipbot
Copy link
Member

Heads up @ss62171, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

user settings: Forgot your password link should directly send you an email.
6 participants