From 7ddf9a7002078185bea1f70c3438d7104abea1b6 Mon Sep 17 00:00:00 2001 From: Sofiya Tepikin Date: Wed, 5 Dec 2018 22:41:41 +0100 Subject: [PATCH] Reuses SettingsButton component --- components/settings/password/update.js | 45 +++++++++++++------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/components/settings/password/update.js b/components/settings/password/update.js index fc10cca..a470e57 100644 --- a/components/settings/password/update.js +++ b/components/settings/password/update.js @@ -10,9 +10,11 @@ import { shared } from '../../../i18n/en/labels' import { settings as labels } from '../../../i18n/en/settings' import { requestHash, changeEncryptionAndRestartApp } from '../../../db' import PasswordField from './password-field' +import SettingsButton from './settings-button' import showBackUpReminder from './show-backup-reminder' import checkCurrentPassword from './check-current-password' + export default class ChangePassword extends Component { constructor() { super() @@ -60,21 +62,23 @@ export default class ChangePassword extends Component { } } + startChangingPassword = () => { + showBackUpReminder(() => { + this.setState({ enteringCurrentPassword: true }) + }) + } + render() { return ( {!this.state.enteringCurrentPassword && !this.state.enteringNewPassword && - showBackUpReminder(() => { - this.setState({ enteringCurrentPassword: true }) - })} - disabled={this.state.currentPassword} - style={styles.settingsButton}> - - {labels.passwordSettings.changePassword} - - + + {labels.passwordSettings.changePassword} + } {this.state.enteringCurrentPassword && @@ -89,14 +93,12 @@ export default class ChangePassword extends Component { value={this.state.currentPassword} placeholder={labels.passwordSettings.enterCurrent} /> - requestHash('pre-change-pw-check', this.state.currentPassword)} disabled={!this.state.currentPassword} - style={styles.settingsButton}> - - {shared.unlock} - - + > + {shared.unlock} + } @@ -112,15 +114,12 @@ export default class ChangePassword extends Component { value={this.state.changedPassword} placeholder={labels.passwordSettings.enterNew} /> - - requestHash('change-pw', this.state.newPassword)} disabled={ !this.state.newPassword } - style={styles.settingsButton}> - - {labels.passwordSettings.changePassword} - - + > + {labels.passwordSettings.changePassword} + }