Files
optolith-client/js/views/account/ForgotUsername.js
T
Lukas Obermann e1927227bf Changed data objects to ES6 classes
Additionally changed folder structure to components and views
2016-11-14 00:18:09 +01:00

60 lines
1.3 KiB
JavaScript

import AccountActions from '../../actions/AccountActions';
import Dialog from '../../components/Dialog';
import React, { Component, PropTypes } from 'react';
import TextField from '../../components/TextField';
import { close } from '../../utils/createOverlay';
class ForgotUsername extends Component {
static props = {
node: PropTypes.any
};
state = {
email: ''
};
forgotUsername = () => AccountActions.forgotUsername(this.state.email);
back = () => AccountActions.showLogin();
_onChange = event => this.setState({ email: event.target.value });
_onEnter = event => {
if (event.charCode === 13 && this.state.email !== '') {
this.forgotUsername();
close(this.props.node);
}
};
render() {
const { email } = this.state;
return (
<Dialog id="forgotusername" title="Benutzername vergessen" node={this.props.node} buttons={[
{
label: 'E-Mail anfordern',
onClick: this.forgotUsername,
primary: true,
disabled: email === ''
},
{
label: 'Zurück',
onClick: this.back
}
]}>
<TextField
hint="Registrierte E-Mail-Adresse"
value={email}
onChange={this._onChange}
onKeyPress={this._onEnter}
type="email"
fullWidth
/>
</Dialog>
);
}
}
export default ForgotUsername;