Skip to content

Commit

Permalink
Merge pull request #10269 from Expensify/revert-10266-revert-10222-yu…
Browse files Browse the repository at this point in the history
…wen-beginSignIn

Start Using BeginSignIn command and remove obsolete API command calls (Take 2)
  • Loading branch information
yuwenmemon authored Aug 8, 2022
2 parents 6a488a2 + 2abb464 commit 9a76034
Show file tree
Hide file tree
Showing 18 changed files with 162 additions and 279 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ For an M1 Mac, read this [SO](https://stackoverflow.com/c/expensify/questions/11
1. If you are having issues with **_Getting Started_**, please reference [React Native's Documentation](https://reactnative.dev/docs/environment-setup)
2. If you are running into CORS errors like (in the browser dev console)
```sh
Access to fetch at 'https://www.expensify.com/api?command=GetAccountStatus' from origin 'http://localhost:8080' has been blocked by CORS policy
Access to fetch at 'https://www.expensify.com/api?command=BeginSignIn' from origin 'http://localhost:8080' has been blocked by CORS policy
```
You probably have a misconfigured `.env` file - remove it (`rm .env`) and try again

Expand Down Expand Up @@ -164,7 +164,7 @@ That action will then call `Onyx.merge()` to [set default data and a loading sta

```js
function signIn(password, twoFactorAuthCode) {
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: true});
Onyx.merge(ONYXKEYS.ACCOUNT, {isLoading: true});
Authentication.Authenticate({
...defaultParams,
password,
Expand All @@ -177,7 +177,7 @@ function signIn(password, twoFactorAuthCode) {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: error.message});
})
.finally(() => {
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false});
Onyx.merge(ONYXKEYS.ACCOUNT, {isLoading: false});
});
}
```
Expand All @@ -188,7 +188,7 @@ Keeping our `Onyx.merge()` out of the view layer and in actions helps organize t
// Bad
validateAndSubmitForm() {
// validate...
this.setState({loading: true});
this.setState({isLoading: true});
signIn()
.then((response) => {
if (result.jsonCode === 200) {
Expand All @@ -198,7 +198,7 @@ validateAndSubmitForm() {
this.setState({error: response.message});
})
.finally(() => {
this.setState({loading: false});
this.setState({isLoading: false});
});
}

Expand Down
3 changes: 0 additions & 3 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ export default {
// The policyID of the last workspace whose settings were accessed by the user
LAST_ACCESSED_WORKSPACE_POLICY_ID: 'lastAccessedWorkspacePolicyID',

// Validating Email?
USER_SIGN_UP: 'userSignUp',

// List of Form ids
FORMS: {
ADD_DEBIT_CARD_FORM: 'addDebitCardForm',
Expand Down
6 changes: 2 additions & 4 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,9 @@ export default {
},
resendValidationForm: {
linkHasBeenResent: 'Link has been re-sent',
weSentYouMagicSignInLink: ({login}) => `We've sent a magic sign in link to ${login}. Check your Inbox and your Spam folder and wait 5-10 minutes before trying again.`,
weSentYouMagicSignInLink: ({login, loginType}) => `I've sent a magic sign-in link to ${login}. Please check your ${loginType} to sign in.`,
resendLink: 'Resend link',
validationCodeFailedMessage: 'It looks like there was an error with your validation link or it has expired.',
unvalidatedAccount: 'This account exists but isn\'t validated, please check your inbox for your magic link.',
newAccount: ({login, loginType}) => `Welcome ${login}, it's always great to see a new face around here! Please check your ${loginType} for a magic link to validate your account.`,
},
detailsPage: {
localTime: 'Local time',
Expand All @@ -523,7 +521,7 @@ export default {
passwordFormTitle: 'Welcome back to the New Expensify! Please set your password.',
passwordNotSet: 'We were unable to set your new password. We have sent you a new password link to try again.',
setPasswordLinkInvalid: 'This set password link is invalid or has expired. A new one is waiting for you in your email inbox!',
verifyingAccount: 'Verifying account',
validatingAccount: 'Verifying account',
},
stepCounter: ({step, total}) => `Step ${step} of ${total}`,
bankAccount: {
Expand Down
6 changes: 2 additions & 4 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,9 @@ export default {
},
resendValidationForm: {
linkHasBeenResent: 'El enlace se ha reenviado',
weSentYouMagicSignInLink: ({login}) => `Hemos enviado un enlace mágico de inicio de sesión a ${login}. Verifica tu bandeja de entrada y tu carpeta de correo no deseado y espera de 5 a 10 minutos antes de intentarlo de nuevo.`,
weSentYouMagicSignInLink: ({login, loginType}) => `Te he enviado un hiperenlace mágico para iniciar sesión a ${login}. Por favor revisa tu ${loginType}`,
resendLink: 'Reenviar enlace',
validationCodeFailedMessage: 'Parece que hubo un error con el enlace de validación o ha caducado.',
unvalidatedAccount: 'Esta cuenta existe pero no está validada, por favor busca el enlace mágico en tu bandeja de entrada',
newAccount: ({login, loginType}) => `¡Bienvenido ${login}, es genial ver una cara nueva por aquí! En tu ${loginType} encontrarás un enlace para validar tu cuenta, por favor, revísalo`,
},
detailsPage: {
localTime: 'Hora local',
Expand All @@ -523,7 +521,7 @@ export default {
passwordFormTitle: '¡Bienvenido de vuelta al Nuevo Expensify! Por favor, elige una contraseña.',
passwordNotSet: 'No pudimos cambiar tu clave. Te hemos enviado un nuevo enlace para que intentes cambiar la clave nuevamente.',
setPasswordLinkInvalid: 'El enlace para configurar tu contraseña ha expirado. Te hemos enviado un nuevo enlace a tu correo.',
verifyingAccount: 'Verificando cuenta',
validatingAccount: 'Verificando cuenta',
},
stepCounter: ({step, total}) => `Paso ${step} de ${total}`,
bankAccount: {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Network/MainQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let networkRequestQueue = [];
* @return {Boolean}
*/
function canMakeRequest(request) {
// Some requests are always made even when we are in the process of authenticating (typically because they require no authToken e.g. Log, GetAccountStatus)
// Some requests are always made even when we are in the process of authenticating (typically because they require no authToken e.g. Log, BeginSignIn)
// However, if we are in the process of authenticating we always want to queue requests until we are no longer authenticating.
return request.data.forceNetworkRequest === true || (!NetworkStore.isAuthenticating() && !SequentialQueue.isRunning());
}
Expand Down
3 changes: 1 addition & 2 deletions src/libs/Network/enhanceParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ function isAuthTokenRequired(command) {
'Log',
'Graphite_Timer',
'Authenticate',
'GetAccountStatus',
'BeginSignIn',
'SetPassword',
'User_SignUp',
'ResendValidateCode',
'User_ReopenAccount',
'ValidateEmail',
], command);
}
Expand Down
Loading

0 comments on commit 9a76034

Please sign in to comment.