-
Notifications
You must be signed in to change notification settings - Fork 212
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
feat(react): Send fxaLogin webchannel message conditionally after password reset #15412
Conversation
// Object.entries(loginData).filter(([key, value]) => value !== undefined) | ||
// ); | ||
// } | ||
const REQUIRED_LOGIN_FIELDS: Array<keyof FxALoginRequest> = [ |
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.
There's a link to what params are used on the FF side above FxALoginRequest
. This is different than the previous "allowed" and "required" fields which were commented out, please see what we're doing in this file and double check me. I figure if there's more we need later for the "confirm" pages we can add them then.
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.
Looks right. One comment, is that although authAt
is listed in the FF source as a field, but I don't see it being used, and it looks like the content-server auth broker model doesn't have it listed as a required field. It seems like what you have is technically more correct though, so it is probably fine.
async resetPassword(email: string): Promise<PasswordForgotSendCodePayload> { | ||
async resetPassword( | ||
email: string, | ||
service?: string |
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'm not sure if this would have been preferred anyway but I tried using CreateRelier
here, and ran into issues. There was nothing in the console, so I worked my way up and saw this was struggling to pull off of Context
here, maybe because this isn't a React component? Didn't dive too deep, since we're replacing links with codes soon anyway, and just called CreateRelier
in the component using it instead.
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 think that's good. I don't think we should be accessing context here. Better to pass it in.
// for (const key of ALLOWED_LOGIN_FIELDS) { | ||
// loginData[key] = account[key]; | ||
// } | ||
// // TODO: account for multiservice when we combine reliers |
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'm going to add this comment back since we do need this. I think this has to do with the signup or confirm view since in content-server, _formatForMultiServiceBrowser
will send offeredSyncEngines
and declinedSyncEngines
. It can be looked at in https://mozilla-hub.atlassian.net/browse/FXA-7308.
}, | ||
}, | ||
}); | ||
currentAccount(getOldSettingsData(accountReset)); | ||
sessionToken(accountReset.sessionToken); | ||
return accountReset; |
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.
Probably a follow up item, but it'd be great to return something other than 'any' here.
Going to go ahead and open this as ready - there are 2 failing tests I'm still looking into but should be g2g otherwise. (edit: not sure why GH is showing no changes since I just pushed, will push again in a sec...) |
I just pushed again with everything passing locally for me but looks like I'm afflicted by the Github outage so it hasn't shown up yet. The push from 1512f88 to 6ca824c contains everything except the last two failures. One thing to note, everything passes but I'm seeing a few warnings around |
@@ -614,51 +629,6 @@ export class Account implements AccountData { | |||
} | |||
} | |||
|
|||
async resendResetPassword( |
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.
Suprised this was duplicated like 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.
Running this locally and looks like storybook is failing
Users/vijaybudhram/Desktop/working/fxa/packages/fxa-settings/src/pages/ResetPassword/CompleteResetPassword/index.stories.tsx
TypeScript error in /Users/vijaybudhram/Desktop/working/fxa/packages/fxa-settings/src/pages/ResetPassword/CompleteResetPassword/index.stories.tsx(10,34):
Module '"./mocks"' has no exported member 'Subject'. TS2305
8 | import { Account } from '../../../models';
9 | import { withLocalization } from '../../../../.storybook/decorators';
> 10 | import { paramsWithMissingEmail, Subject } from './mocks';
| ^
11 |
12 | export default {
13 | title: 'Pages/ResetPassword/CompleteResetPassword',
Looks like Subject
is now renderSubject
?
45eb136
to
de6c7ca
Compare
@dschom @vbudhram I had to refactor some mocks/tests/storybook things due to this. I'd changed it so
Feel free to test locally now though (and comment out the DamagedLink stories to see the others), if you create an account and then run |
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.
@LZoog Works as described! LGTM 👍🏽
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.
LGMT
@@ -76,7 +76,8 @@ const renderSubject = ({ | |||
account = accountWithValidResetToken, | |||
params = mockCompleteResetPasswordParams, | |||
} = {}) => { | |||
render(<Subject {...{ account, params }} />); | |||
const { Subject, history, appCtx } = getSubject(account, params); | |||
return renderWithRouter(<Subject />, { history }, appCtx); |
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.
Note that the 'render' import above is no longer used!
@@ -6,14 +6,21 @@ import React from 'react'; | |||
import { MozServices } from '../../../lib/types'; | |||
import { LocationProvider } from '@reach/router'; | |||
import { Account, AppContext } from '../../../models'; | |||
import { mockAppContext, MOCK_ACCOUNT } from '../../../models/mocks'; | |||
import { |
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.
LocationProvider and AppContext on the lines above are both unnused now.
mockCompleteResetPasswordParams, | ||
paramsWithMissingCode, | ||
paramsWithMissingEmail, | ||
paramsWithMissingEmailToHashWith, | ||
paramsWithMissingToken, | ||
paramsWithSyncDesktop, | ||
Subject, | ||
} from './mocks'; |
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.
Subject isn't used
@@ -3,26 +3,22 @@ | |||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |||
|
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.
render isn't used
</LocationProvider> | ||
</AppContext.Provider> | ||
); | ||
storageData: new StorageDataMock(windowWrapper), |
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.
Accoding to the type account must always be defined. Is there a reason for the account &&
@@ -9,7 +9,13 @@ import CompleteResetPassword from '.'; | |||
import LinkValidator from '../../../components/LinkValidator'; | |||
import { StorageData, UrlQueryData } from '../../../lib/model-data'; | |||
import { Account, AppContext } from '../../../models'; |
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.
AppContext unused and LocationProvider above is also unused.
@@ -4,71 +4,53 @@ | |||
|
|||
import React from 'react'; |
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.
AppContext & LocationProvider are not used.
mockAppContext, | ||
MOCK_ACCOUNT, | ||
createHistoryWithQuery, | ||
renderWithRouter, |
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.
renderWithRouter not used. Same with AppContext & LocationProvider.
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.
renderWithRouter not used. Same with AppContex & LocationProvider.
route: string, | ||
account = MOCK_ACCOUNT as unknown as Account, | ||
queryParams?: string, | ||
appCtx?: AppContextValue |
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.
appCtx not used?
mockAppContext, | ||
MOCK_ACCOUNT, | ||
createHistoryWithQuery, | ||
renderWithRouter, |
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.
renderWithRouter not used. Same with ApPContext & LocationProvider above.
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.
@dschom Thanks for all the callouts. I said this in some other issue but I thought unused imports would show up in CI or something now.
…sword reset Because: * The browser should be be notified when a PW reset occurs on a verified account through the Sync flow, as this logs the user in This commit: * Conditionally runs the fxaLogin command with required account data after a password reset with or without recovery key, when the flow is sync * Receives other values off the account reset call needed for webchannel account data * Temporarily checks for SyncBasic and SyncDesktop flows to run the check because we don't need to port over context in local storage logic (which would account for SyncDesktop only), since we are switching to codes soon * Sends up `service` with the email request so we can append the param and check when link is received (causing the SyncBasic integration) * Removes resendResetPassword and calls resetPassword where needed since the code was duplicated Fixes FXA-7172
Just pushed an update removing unused imports. Going to go ahead and merge since CI was already happy and we are about to tag. |
Because:
This commit:
service
with the email request so we can append the param and check when link is received (causing the SyncBasic integration)Fixes FXA-7172