Skip to content
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

Rename and restyle set password form #2211

Merged
merged 26 commits into from
Apr 27, 2021
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
075c60d
Rename the SetPasswordPage => SetPasswordForm, change its styles to m…
jasperhuangg Apr 2, 2021
eb68583
Fix missing handler
jasperhuangg Apr 2, 2021
07a0cd4
Change SignInPageLayout to use SafeAreaView
jasperhuangg Apr 2, 2021
bd56c30
Change SignInPageLayout to use SafeAreaView
jasperhuangg Apr 2, 2021
fbc5a25
Fix style, remove unused
jasperhuangg Apr 2, 2021
5c4a3d1
merge from jasper-fixLoginForm
jasperhuangg Apr 5, 2021
4ee23f7
Fix JSX
jasperhuangg Apr 5, 2021
aef86c3
Merge master
jasperhuangg Apr 13, 2021
01eafbb
merge master
jasperhuangg Apr 20, 2021
10c3d07
merge main
jasperhuangg Apr 20, 2021
a9a8dfb
autoFocus conditionally
jasperhuangg Apr 20, 2021
775084c
Fix form values
jasperhuangg Apr 20, 2021
8d4bff6
Add accountID to route
jasperhuangg Apr 21, 2021
2ddd8ca
Merge branch 'main' of github.com:Expensify/Expensify.cash into jaspe…
jasperhuangg Apr 21, 2021
1595ee4
Wrap narrow/wide SignInPageLayout with SafeAreaView
jasperhuangg Apr 21, 2021
dfe45d9
Change SafeAreaView placement
jasperhuangg Apr 21, 2021
d2ba95f
Revert unneeded change
jasperhuangg Apr 22, 2021
893b7ef
Remove unused
jasperhuangg Apr 22, 2021
8396bbe
Revert renaming of file
jasperhuangg Apr 22, 2021
58476dd
Revert proptypes change.
jasperhuangg Apr 26, 2021
6e72087
Remove windowDimensions from SignInPage.js
jasperhuangg Apr 26, 2021
f7c0dc7
Revert new line
jasperhuangg Apr 27, 2021
b3adcef
Remove unnecessary compose
jasperhuangg Apr 27, 2021
245cb91
Move import back
jasperhuangg Apr 27, 2021
d0a6d1d
Move import back
jasperhuangg Apr 27, 2021
ea0e16f
Merge branch 'main' into jasper-fixSetPasswordPage
jasperhuangg Apr 27, 2021
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
88 changes: 43 additions & 45 deletions src/pages/SetPasswordPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import _ from 'underscore';
import lodashGet from 'lodash/get';
import validateLinkPropTypes from './validateLinkPropTypes';
import styles from '../styles/styles';
import ExpensifyCashLogo from '../components/ExpensifyCashLogo';
import {setPassword} from '../libs/actions/Session';
import ONYXKEYS from '../ONYXKEYS';
import variables from '../styles/variables';
import ButtonWithLoader from '../components/ButtonWithLoader';
import themeColors from '../styles/themes/default';
import SignInPageLayout from './signin/SignInPageLayout';
import canFocusInputOnScreenFocus from '../libs/canFocusInputOnScreenFocus';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -54,7 +55,7 @@ class SetPasswordPage extends Component {
constructor(props) {
super(props);

this.submitForm = this.submitForm.bind(this);
this.validateAndSubmitForm = this.validateAndSubmitForm.bind(this);

this.state = {
password: '',
Expand All @@ -65,7 +66,7 @@ class SetPasswordPage extends Component {
/**
* Validate the form and then submit it
*/
submitForm() {
validateAndSubmitForm() {
if (!this.state.password.trim()) {
this.setState({
formError: 'Password cannot be blank',
Expand All @@ -85,47 +86,44 @@ class SetPasswordPage extends Component {

render() {
return (
<>
<View style={[styles.signInPage]}>
<SafeAreaView>
<View style={[styles.signInPageInner]}>
<View style={[styles.signInPageLogo]}>
<ExpensifyCashLogo
width={variables.componentSizeLarge}
height={variables.componentSizeLarge}
/>
</View>
<View style={[styles.mb4]}>
<Text style={[styles.formLabel]}>Enter a password</Text>
<TextInput
style={[styles.textInput]}
secureTextEntry
autoCompleteType="password"
textContentType="password"
value={this.state.password}
onChangeText={text => this.setState({password: text})}
onSubmitEditing={this.submitForm}
/>
</View>
<ButtonWithLoader
text="Set Password"
onClick={this.submitForm}
isLoading={this.props.account.loading}
/>
{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
</Text>
)}
{!_.isEmpty(this.props.account.error) && (
<Text style={[styles.formError]}>
{this.props.account.error}
</Text>
)}
</View>
</SafeAreaView>
</View>
</>
<SafeAreaView style={[styles.signInPage]}>
<SignInPageLayout>
<View style={[styles.mb4]}>
<Text style={[styles.formLabel]}>Enter a password:</Text>
<TextInput
style={[styles.textInput]}
value={this.state.password}
secureTextEntry
autoCompleteType="password"
textContentType="password"
onChangeText={text => this.setState({password: text})}
onSubmitEditing={this.validateAndSubmitForm}
autoCapitalize="none"
placeholderTextColor={themeColors.placeholderText}
autoFocus={canFocusInputOnScreenFocus()}
/>
</View>
<View>
<ButtonWithLoader
text="Set Password"
isLoading={this.props.account.loading}
onClick={this.validateAndSubmitForm}
/>
</View>

{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
</Text>
)}

{!_.isEmpty(this.props.account.error) && (
<Text style={[styles.formError]}>
{this.props.account.error}
</Text>
)}
</SignInPageLayout>
</SafeAreaView>
);
}
}
Expand Down