diff --git a/components/settings/password/delete.js b/components/settings/password/delete.js index c80b397e70905fe8ce93b849e954f865c44a62f1..016cae43141f6f9b972088de1a8b7ac1c38d8207 100644 --- a/components/settings/password/delete.js +++ b/components/settings/password/delete.js @@ -14,6 +14,7 @@ export default class DeletePassword extends Component { startConfirmWithPassword = () => { this.setState({ enteringCurrentPassword: true }) + this.props.onStartDeletingPassword() } startDeletePassword = async () => { diff --git a/components/settings/password/index.js b/components/settings/password/index.js index fca09664f5cd06f6dce2ac4e61430fd9ce3e4def..ccc245290cdfc261c7937a8b53003e3f856ca854 100644 --- a/components/settings/password/index.js +++ b/components/settings/password/index.js @@ -15,29 +15,57 @@ export default class PasswordSetting extends Component { super(props) this.state = { showUpdateAndDelete: hasEncryptionObservable.value, - showCreate: !hasEncryptionObservable.value + showCreate: !hasEncryptionObservable.value, + isChangingPassword: false, + isDeletingPassword: false } } + onChangingPassword = () => { + this.setState({ isChangingPassword: true }) + } + + onDeletingPassword = () => { + this.setState({ isDeletingPassword: true }) + } + render() { + + const { + showUpdateAndDelete, + isChangingPassword, + isDeletingPassword, + showCreate + } = this.state + return ( <ScrollView> <SettingsSegment title={labels.passwordSettings.title}> - {this.state.showUpdateAndDelete ? + {showUpdateAndDelete ? <AppText>{labels.passwordSettings.explainerEnabled}</AppText> : <AppText>{labels.passwordSettings.explainerDisabled}</AppText> } - {this.state.showUpdateAndDelete && - <View> - <ChangePassword/> - <DeletePassword/> - </View> + { + showUpdateAndDelete && ( + <View> + {(isChangingPassword + || !isChangingPassword && !isDeletingPassword) + && <ChangePassword + onStartChangingPassword = {this.onChangingPassword} + />} + {(isDeletingPassword + || !isChangingPassword && !isDeletingPassword) + && <DeletePassword + onStartDeletingPassword = {this.onDeletingPassword} + />} + </View> + ) } - {this.state.showCreate && + {showCreate && <CreatePassword/> } diff --git a/components/settings/password/update.js b/components/settings/password/update.js index 3879df49e4e10ec685c7ba19ca6625b028ff082a..81b2ba92174e210ae1c4f8c06001519c0d93471e 100644 --- a/components/settings/password/update.js +++ b/components/settings/password/update.js @@ -20,6 +20,7 @@ export default class ChangePassword extends Component { showBackUpReminder(() => { this.setState({ enteringCurrentPassword: true }) }) + this.props.onStartChangingPassword() } startEnteringNewPassword = () => {