Skip to content

feat(password): Add ability to set password after third party login to Sync#15602

Merged
vbudhram merged 1 commit intomainfrom
fxa-8033
Jul 28, 2023
Merged

feat(password): Add ability to set password after third party login to Sync#15602
vbudhram merged 1 commit intomainfrom
fxa-8033

Conversation

@vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Jul 26, 2023

Because

  • Sync requires a password to encrypt a user's data, third party accounts don't have this set

This pull request

  • Prompts the user to set a password after logging in via a third party and into Sync
  • After setting password they are logged into Sync

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-8033

Checklist

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots

Please attach the screenshots of the changes made in case of change in user interface.

Screenshot 2023-07-25 at 9 46 36 PM

Notes

To test, login via http://localhost:8080 using "Sign-in (Google)" link. After logging in, log into Sync via hamburger menu. You should be prompted to set a password after completing the Google auth flow.

@nx-cloud
Copy link

nx-cloud bot commented Jul 26, 2023

this.metrics.flush();

// Sync service requires a password to be set before it can be used.
if (this.relier.isSync()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also check if the account is missing a password?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yea we should, updating

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested this a few more times, a user won't be able to do social login for Sync. They are almost prompted to enter password if they have it.

@clouserw clouserw requested a review from a team July 27, 2023 18:42
@vbudhram vbudhram requested a review from dschom July 27, 2023 19:16
</div>

<div class="tooltip-container mb-5">
<input id="vpassword" type="password" class="input-text tooltip-below" placeholder="{{#t}}Repeat password{{/t}}" pattern=".{8,}" required data-synchronize-show="true" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need name="vpassword" also to match L20?


<div class="input-balloon hidden" id="vpassword-balloon">
<div class="before:content-key flex before:w-8">
<p class="ltr:pl-2 rtl:pr-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

@LZoog / @vpomerleau can we use ps-2 here instead of bi-di specific props?

Suggested change
<p class="ltr:pl-2 rtl:pr-2">
<p class="ps-2">

{{#t}}Choose what to sync{{/t}}
</h2>
</header>
<div class="flex flex-wrap text-start ltr:mobileLandscape:ml-6 rtl:mobileLandscape:mr-6 mb-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

Same Q here re: ltr:mobileLandscape:ml-6 rtl:mobileLandscape:mr-6 versus ms-6

Suggested change
<div class="flex flex-wrap text-start ltr:mobileLandscape:ml-6 rtl:mobileLandscape:mr-6 mb-1">
<div class="flex flex-wrap text-start mobileLandscape:ms-6 mb-1">

</header>
<div class="flex flex-wrap text-start ltr:mobileLandscape:ml-6 rtl:mobileLandscape:mr-6 mb-1">
{{#engines}}
<div class="mb-4 relative flex-50% rtl:mobileLandscape:pr-6 ltr:mobileLandscape:pl-6 rtl:pr-3 ltr:pl-3 flex items-center">
Copy link
Contributor

Choose a reason for hiding this comment

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

… and here:

Suggested change
<div class="mb-4 relative flex-50% rtl:mobileLandscape:pr-6 ltr:mobileLandscape:pl-6 rtl:pr-3 ltr:pl-3 flex items-center">
<div class="mb-4 relative flex-50% mobileLandscape:ps-6 ps-3 flex items-center">

Disclaimer: I'm very possibly not correct, so I'll defer to Tailwind aficionados @vpomerleau and @LZoog.

</p>

<div class="tooltip-container mb-5">
<input name="password" id="password" type="password" class="input-text tooltip-below" placeholder="{{#t}}Password{{/t}}" value="{{ password }}" pattern=".{8,}" required autofocus data-form-prefill="password" data-synchronize-show="true" />
Copy link
Contributor

Choose a reason for hiding this comment

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

HHmm, I should probably know this, but do these <input> fields need a <label> for a11y reasons? Or maybe a screen-reader-only label field isn't great for a11y-ing.
/summon my a11y gurus @sardesam and @xlisachan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pdehaan I'm gonna defer some of these changes for now, they were taken from other pages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. There are some exceptions (like a submit button for example), but in general they all should. Placeholders do not replace labels and while seen by sighted customers, they are not heard by screenreaders or other ATs.

As suggested, they can be hidden visually, but they should be included for a11y.

Comment on lines +17 to +18
const PASSWORD_INPUT_SELECTOR = '#password';
const VPASSWORD_INPUT_SELECTOR = '#vpassword';
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: should these be exported?
Looks like we have similar consts in

const PASSWORD_INPUT_SELECTOR = '#password';
const VPASSWORD_INPUT_SELECTOR = '#vpassword';

Comment on lines +19 to +20
const PASSWORD_INPUT_SELECTOR = '#password';
const VPASSWORD_INPUT_SELECTOR = '#vpassword';
Copy link
Contributor

Choose a reason for hiding this comment

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

I left a note above about import/exporting these from

const PASSWORD_INPUT_SELECTOR = '#password';
const VPASSWORD_INPUT_SELECTOR = '#vpassword';

But maybe they're far enough apart (maybe ../../../../scripts/views/post_verify/third_party_auth/set_password.js) that hardcoding them in each file is better. 🤷

Copy link
Contributor

@dschom dschom left a comment

Choose a reason for hiding this comment

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

Just got done with some manual testing. It looks great and works as expected. 👍

I noticed that after supplying the password, I am no longer given the option to to sign in with google when signing in from sync. Is this expected? Regardless, it doesn't seem directly related to these changes.

@vbudhram vbudhram merged commit 2bd26af into main Jul 28, 2023
@vbudhram vbudhram deleted the fxa-8033 branch July 28, 2023 18:17
@vbudhram
Copy link
Contributor Author

I am no longer given the option to to sign in with google when signing in from sync. Is this expected?

Correct that is expected. Sync requires a password so if we showed the social options, they would still need to enter password after third party auth.

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.

5 participants