Files
old-svijetlastrana-front/src/routes/forgotPassword/components/ForgotPassword.js

87 lines
2.3 KiB
JavaScript
Raw Normal View History

2018-05-07 16:07:00 +02:00
import React from 'react';
import APPCONFIG from 'constants/Config';
import TextField from 'material-ui/TextField';
import QueueAnim from 'rc-queue-anim';
2018-06-01 05:04:24 +02:00
import RaisedButton from 'material-ui/RaisedButton';
import Instance from '../../../components/Connection';
2018-05-07 16:07:00 +02:00
class ForgotPassowrd extends React.Component {
constructor() {
super();
this.state = {
2018-06-01 05:04:24 +02:00
brand: APPCONFIG.brand,
email: '',
2018-05-07 16:07:00 +02:00
};
2018-06-01 05:04:24 +02:00
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';
});
2018-05-07 16:07:00 +02:00
}
render() {
return (
<div className="body-inner">
<div className="card bg-white">
<div className="card-content">
<section className="logo text-center">
<h1><a href="#/">{this.state.brand}</a></h1>
</section>
<form>
<fieldset>
<div className="form-group">
<TextField
floatingLabelText="Email"
2018-06-01 05:04:24 +02:00
onChange={this.handleEmail}
2018-05-07 16:07:00 +02:00
type="email"
fullWidth
/>
<div className="text-small">
<p>Enter the email address for your account.</p>
<p>We will email your username and a link to reset your password.</p>
</div>
</div>
</fieldset>
</form>
</div>
<div className="card-action no-border text-right">
2018-06-01 05:04:24 +02:00
<RaisedButton
label="Reset"
primary={true}
onClick={this.clickEvent}
disabled={this.state.email===''}
/>
2018-05-07 16:07:00 +02:00
</div>
</div>
</div>
);
}
}
const Page = () => (
<div className="page-forgot">
<div className="main-body">
<QueueAnim type="bottom" className="ui-animate">
<div key="1">
<ForgotPassowrd />
</div>
</QueueAnim>
</div>
</div>
);
module.exports = Page;