(core) Move user profile to new page and begin MFA work

Summary:
The user profile dialog is now a separate page, in preparation
for upcoming work to enable MFA. This commit also contains
some MFA changes, but the UI is currently disabled and the
implementation is limited to software tokens (TOTP) only.

Test Plan:
Updated browser tests for new profile page. Tests for MFAConfig
and CognitoClient will be added in a later diff, once the UI is enabled.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3199
This commit is contained in:
George Gevoian
2022-01-07 10:11:52 -08:00
parent 8f531ef622
commit ba6ecc5e9e
21 changed files with 1179 additions and 211 deletions

View File

@@ -145,14 +145,14 @@ export class UrlStateImpl {
*/
public updateState(prevState: IGristUrlState, newState: IGristUrlState): IGristUrlState {
const keepState = (newState.org || newState.ws || newState.homePage || newState.doc || isEmpty(newState) ||
newState.billing || newState.welcome) ?
newState.account || newState.billing || newState.welcome) ?
(prevState.org ? {org: prevState.org, newui: prevState.newui} : {}) :
prevState;
return {...keepState, ...newState};
}
/**
* Billing pages and doc-specific pages for now require a page load.
* The account page, billing pages, and doc-specific pages for now require a page load.
* TODO: Make it so doc pages do NOT require a page load, since we are actually serving the same
* single-page app for home and for docs, and should only need a reload triggered if it's
* a matter of DocWorker requiring a different version (e.g. /v/OTHER/doc/...).
@@ -162,6 +162,8 @@ export class UrlStateImpl {
const orgReload = prevState.org !== newState.org;
// Reload when moving to/from a document or between doc and non-doc.
const docReload = prevState.doc !== newState.doc;
// Reload when moving to/from the account page.
const accountReload = Boolean(prevState.account) !== Boolean(newState.account);
// Reload when moving to/from a billing page.
const billingReload = Boolean(prevState.billing) !== Boolean(newState.billing);
// Reload when changing 'newui' flag.
@@ -170,7 +172,7 @@ export class UrlStateImpl {
const welcomeReload = Boolean(prevState.welcome) !== Boolean(newState.welcome);
// Reload when link keys change, which changes what the user can access
const linkKeysReload = !isEqual(prevState.params?.linkParameters, newState.params?.linkParameters);
return Boolean(orgReload || billingReload || gristConfig.errPage
return Boolean(orgReload || accountReload || billingReload || gristConfig.errPage
|| docReload || newuiReload || welcomeReload || linkKeysReload);
}