import React, {Component} from 'react'; import {connect} from 'react-redux'; import {Row, Col, Button, Alert} from 'reactstrap'; import WiaasBox from '../../mainComponents/box/WiaasBox.jsx'; import {generatePassword} from '../../actions/login/authActions'; import {profileTexts} from '../../constants/profileSettingsConstants'; import {loginMessages} from '../../constants/authConstants'; class ChangePasswordContainer extends Component { constructor(props){ super(props); this.state = { isPasswordChanged: false }; this.generatePassword = this.generatePassword.bind(this); } generatePassword() { const {mail} = this.props.profileInfo || ''; this.props.dispatch(generatePassword(mail)); this.setState({isPasswordChanged: true}); } render() { return (
{profileTexts.labels.CHANGE_PASSWORD}
{ this.state.isPasswordChanged &&
{loginMessages[this.props.errorMessage] && {loginMessages[this.props.errorMessage]}}
}
); } } const mapStateToProps = (state) => ({ errorMessage: state.auth.errorMessage, messageColor: state.auth.messageColor }); export default connect(mapStateToProps)(ChangePasswordContainer);