From c170c4a52aa149f78a648eb4e0ade6f0cdae4f38 Mon Sep 17 00:00:00 2001 From: OSBotify <76178356+OSBotify@users.noreply.github.com> Date: Tue, 21 Sep 2021 13:52:08 -0700 Subject: [PATCH 1/2] Merge pull request #5401 from Expensify/version-BUILD-a609010b7d89674afdf5aca9683d86426ba742cd (cherry picked from commit 1901df375c91eef883f455caf8b5dadeddb9bf9f) --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 8a1c353d6b30..5d66caa04064 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -150,8 +150,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001010001 - versionName "1.1.0-1" + versionCode 1001010002 + versionName "1.1.0-2" } splits { abi { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 7afb072bd774..dd9be42a327a 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -31,7 +31,7 @@ CFBundleVersion - 1.1.0.1 + 1.1.0.2 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 3532a7c43a1e..580888a40663 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.1.0.1 + 1.1.0.2 diff --git a/package-lock.json b/package-lock.json index e1521dc08c0e..21e93841fed9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.0-1", + "version": "1.1.0-2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index eed88eee4a88..4e3989b28a17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.0-1", + "version": "1.1.0-2", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From 8a09c91f20adeb6ffcb0a54b058b6b6bfcc7b8f0 Mon Sep 17 00:00:00 2001 From: Joe Gambino Date: Tue, 21 Sep 2021 13:49:50 -0700 Subject: [PATCH 2/2] Merge pull request #5398 from Expensify/joe-fix-validate-error Fix forgot password functionality for validated logins (cherry picked from commit a609010b7d89674afdf5aca9683d86426ba742cd) --- src/CONST.js | 7 +++++++ src/libs/actions/Session.js | 5 +++++ src/pages/SetPasswordPage.js | 11 +++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index 206ac649f5e5..894e58f7fad5 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -244,6 +244,13 @@ const CONST = { // at least 8 characters, 1 capital letter, 1 lowercase number, 1 number PASSWORD_COMPLEXITY_REGEX_STRING: '^(?=.*[A-Z])(?=.*[0-9])(?=.*[a-z]).{8,}$', + PASSWORD_PAGE: { + ERROR: { + ALREADY_VALIDATED: 'Account already validated', + VALIDATE_CODE_FAILED: 'Validate code failed', + }, + }, + EMOJI_SPACER: 'SPACER', LOGIN_TYPE: { diff --git a/src/libs/actions/Session.js b/src/libs/actions/Session.js index 7acd4c93cf17..9629b613b7ad 100644 --- a/src/libs/actions/Session.js +++ b/src/libs/actions/Session.js @@ -271,6 +271,11 @@ function setPassword(password, validateCode, accountID) { // This request can fail if the password is not complex enough Onyx.merge(ONYXKEYS.ACCOUNT, {error: response.message}); }) + .catch((response) => { + if (response.message === CONST.PASSWORD_PAGE.ERROR.VALIDATE_CODE_FAILED) { + Onyx.merge(ONYXKEYS.ACCOUNT, {error: translateLocal('setPasswordPage.accountNotValidated')}); + } + }) .finally(() => { Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false}); }); diff --git a/src/pages/SetPasswordPage.js b/src/pages/SetPasswordPage.js index 9e95b3ad4022..32bdc06f63c0 100755 --- a/src/pages/SetPasswordPage.js +++ b/src/pages/SetPasswordPage.js @@ -9,7 +9,7 @@ import _ from 'underscore'; import lodashGet from 'lodash/get'; import validateLinkPropTypes from './validateLinkPropTypes'; import styles from '../styles/styles'; -import {signIn} from '../libs/actions/Session'; +import {setPassword, signIn} from '../libs/actions/Session'; import ONYXKEYS from '../ONYXKEYS'; import Button from '../components/Button'; import SignInPageLayout from './signin/SignInPageLayout'; @@ -18,6 +18,7 @@ import compose from '../libs/compose'; import NewPasswordForm from './settings/NewPasswordForm'; import Text from '../components/Text'; import * as API from '../libs/API'; +import CONST from '../CONST'; const propTypes = { /* Onyx Props */ @@ -93,6 +94,13 @@ class SetPasswordPage extends Component { }); } }); + } else if (responseValidate.title === CONST.PASSWORD_PAGE.ERROR.ALREADY_VALIDATED) { + // If the email is already validated, set the password using the validate code + setPassword( + this.state.password, + lodashGet(this.props.route, 'params.validateCode', ''), + lodashGet(this.props.route, 'params.accountID', ''), + ); } else { this.setState({ error: this.props.translate('setPasswordPage.accountNotValidated'), @@ -124,7 +132,6 @@ class SetPasswordPage extends Component { isDisabled={!this.state.isFormValid} /> - {!_.isEmpty(error) && ( {error}