handle reset confirmation page

This commit is contained in:
GotPPay
2018-06-01 05:04:24 +02:00
parent 6c262a03d9
commit cd30c937f0
4 changed files with 57 additions and 29 deletions

View File

@@ -2,13 +2,33 @@ import React from 'react';
import APPCONFIG from 'constants/Config';
import TextField from 'material-ui/TextField';
import QueueAnim from 'rc-queue-anim';
import RaisedButton from 'material-ui/RaisedButton';
import Instance from '../../../components/Connection';
class ForgotPassowrd extends React.Component {
constructor() {
super();
this.state = {
brand: APPCONFIG.brand
brand: APPCONFIG.brand,
email: '',
};
this.handleEmail = this.handleEmail.bind(this);
}
handleEmail = (event) => {
this.setState(Object.assign(this.state, { email: event.target.value }));
};
clickEvent = (event) => {
event.preventDefault();
Instance.setToken(null).post('/v1/passwordreset/request/' + this.state.email).then(function (res) {
location.href = '/#/confirm-email';
}).catch(function (err) {
location.href = '/#/confirm-email';
});
}
render() {
@@ -24,6 +44,7 @@ class ForgotPassowrd extends React.Component {
<div className="form-group">
<TextField
floatingLabelText="Email"
onChange={this.handleEmail}
type="email"
fullWidth
/>
@@ -36,7 +57,12 @@ class ForgotPassowrd extends React.Component {
</form>
</div>
<div className="card-action no-border text-right">
<a href="/#/confirm-email" className="color-primary">Reset</a>
<RaisedButton
label="Reset"
primary={true}
onClick={this.clickEvent}
disabled={this.state.email===''}
/>
</div>
</div>
</div>