Skip to content

Revert "Start Using BeginSignIn command and remove obsolete API command calls" #10266

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

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=BeginSignIn' from origin 'http://localhost:8080' has been blocked by CORS policy
Access to fetch at 'https://www.expensify.com/api?command=GetAccountStatus' 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, {isLoading: true});
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: 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, {isLoading: false});
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: 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({isLoading: true});
this.setState({loading: true});
signIn()
.then((response) => {
if (result.jsonCode === 200) {
Expand All @@ -198,7 +198,7 @@ validateAndSubmitForm() {
this.setState({error: response.message});
})
.finally(() => {
this.setState({isLoading: false});
this.setState({loading: false});
});
}

Expand Down
3 changes: 3 additions & 0 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ 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: 4 additions & 2 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@ export default {
},
resendValidationForm: {
linkHasBeenResent: 'Link has been re-sent',
weSentYouMagicSignInLink: ({login, loginType}) => `I've sent a magic sign-in link to ${login}. Please check your ${loginType} to sign in.`,
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.`,
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 @@ -521,7 +523,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!',
validatingAccount: 'Verifying account',
verifyingAccount: 'Verifying account',
},
stepCounter: ({step, total}) => `Step ${step} of ${total}`,
bankAccount: {
Expand Down
6 changes: 4 additions & 2 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@ export default {
},
resendValidationForm: {
linkHasBeenResent: 'El enlace se ha reenviado',
weSentYouMagicSignInLink: ({login, loginType}) => `Te he enviado un hiperenlace mágico para iniciar sesión a ${login}. Por favor revisa tu ${loginType}`,
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.`,
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 @@ -521,7 +523,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.',
validatingAccount: 'Verificando cuenta',
verifyingAccount: '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, BeginSignIn)
// Some requests are always made even when we are in the process of authenticating (typically because they require no authToken e.g. Log, GetAccountStatus)
// 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: 2 additions & 1 deletion src/libs/Network/enhanceParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ function isAuthTokenRequired(command) {
'Log',
'Graphite_Timer',
'Authenticate',
'BeginSignIn',
'GetAccountStatus',
'SetPassword',
'User_SignUp',
'ResendValidateCode',
'User_ReopenAccount',
'ValidateEmail',
], command);
}
Expand Down
Loading