Skip to content

Commit

Permalink
Merge pull request #5402 from Expensify/OSBotify-cherry-pick-staging-…
Browse files Browse the repository at this point in the history
…5398
  • Loading branch information
OSBotify authored Sep 21, 2021
2 parents f5ca5a7 + 8a09c91 commit 0ff8224
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 8 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.0.1</string>
<string>1.1.0.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.0.1</string>
<string>1.1.0.2</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
7 changes: 7 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
5 changes: 5 additions & 0 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
});
Expand Down
11 changes: 9 additions & 2 deletions src/pages/SetPasswordPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 */
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -124,7 +132,6 @@ class SetPasswordPage extends Component {
isDisabled={!this.state.isFormValid}
/>
</View>

{!_.isEmpty(error) && (
<Text style={[styles.formError]}>
{error}
Expand Down

0 comments on commit 0ff8224

Please sign in to comment.