From 46e5efbd559c02c6cae73589ef6e461de856f0f0 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 7 May 2018 15:00:55 -0300 Subject: [PATCH] validation for password input in change email --- .../components/ChangeEmailContentDialog.js | 19 ++++++++++++------- .../client/components/Profile.js | 7 +++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.js b/plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.js index 1f1719444..b80529d82 100644 --- a/plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.js +++ b/plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.js @@ -18,10 +18,18 @@ class ChangeEmailContentDialog extends React.Component { confirmChanges = async e => { e.preventDefault(); + + if (this.formHasError()) { + this.showError(); + return; + } + await this.props.save(); this.props.next(); }; + formHasError = () => this.props.hasError('confirmPassword'); + render() { return (
@@ -53,15 +61,10 @@ class ChangeEmailContentDialog extends React.Component { type="password" onChange={this.props.onChange} defaultValue="" - hasError={ - !this.props.formData.confirmPassword && this.state.showError - } - errorMsg={t( - 'talk-plugin-local-auth.change_email.incorrect_password' - )} + hasError={this.props.hasError('confirmPassword')} + errorMsg={this.props.getError('confirmPassword')} showError={this.state.showError} columnDisplay - showSuccess={false} />