From e4b0680a795bfeda5575f2be3e4b6359dc01bd2d Mon Sep 17 00:00:00 2001 From: David Lu Date: Tue, 9 Aug 2016 17:00:51 -0400 Subject: Fixed reset password error (#3769) --- .../components/admin_console/reset_password_modal.jsx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'webapp') diff --git a/webapp/components/admin_console/reset_password_modal.jsx b/webapp/components/admin_console/reset_password_modal.jsx index 6d5a03f2a..dee04b87c 100644 --- a/webapp/components/admin_console/reset_password_modal.jsx +++ b/webapp/components/admin_console/reset_password_modal.jsx @@ -3,17 +3,10 @@ import ReactDOM from 'react-dom'; import Client from 'client/web_client.jsx'; -import Constants from 'utils/constants.jsx'; +import * as Utils from 'utils/utils.jsx'; import {Modal} from 'react-bootstrap'; -import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; - -var holders = defineMessages({ - submit: { - id: 'admin.reset_password.submit', - defaultMessage: 'Please enter at least {chars} characters.' - } -}); +import {injectIntl, intlShape, FormattedMessage} from 'react-intl'; import React from 'react'; @@ -31,13 +24,13 @@ class ResetPasswordModal extends React.Component { doSubmit(e) { e.preventDefault(); - var password = ReactDOM.findDOMNode(this.refs.password).value; + const password = this.refs.password.value; - if (!password || password.length < Constants.MIN_PASSWORD_LENGTH) { - this.setState({serverError: this.props.intl.formatMessage(holders.submit, {chars: Constants.MIN_PASSWORD_LENGTH})}); + const passwordErr = Utils.isValidPassword(password); + if (passwordErr) { + this.setState({serverError: passwordErr}); return; } - this.setState({serverError: null}); Client.adminResetPassword( -- cgit v1.2.3-1-g7c22