From 6c95502b4eca32af1c30b123b76fa533e49008f1 Mon Sep 17 00:00:00 2001 From: Lance Ruegger Date: Thu, 5 Oct 2017 17:36:38 -0700 Subject: [PATCH 1/5] Change DOM input to coral-ui TextField to inherit styling, add prop-types validation, convert from using ref to using state. --- .../client/components/ForgotContent.js | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/plugins/talk-plugin-auth/client/components/ForgotContent.js b/plugins/talk-plugin-auth/client/components/ForgotContent.js index 916c3f5b3..49692abbb 100644 --- a/plugins/talk-plugin-auth/client/components/ForgotContent.js +++ b/plugins/talk-plugin-auth/client/components/ForgotContent.js @@ -1,14 +1,27 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styles from './styles.css'; -import {Button} from 'plugin-api/beta/client/components/ui'; +import {Button, TextField} from 'plugin-api/beta/client/components/ui'; import t from 'coral-framework/services/i18n'; class ForgotContent extends React.Component { + constructor() { + super(); + this.state = { + value: '', + }; + } + handleSubmit = (e) => { e.preventDefault(); - this.props.fetchForgotPassword(this.emailInput.value); + this.props.fetchForgotPassword(this.state.value); }; + handleChangEmail = (e) => { + const {value} = e.target; + this.setState({value}); + } + render() { const {changeView, auth} = this.props; const {passwordRequestSuccess, passwordRequestFailure} = auth; @@ -20,13 +33,13 @@ class ForgotContent extends React.Component {
- - (this.emailInput = input)} - type="text" +