2017-06-08 23:15:34 +02:00
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
|
|
|
import { FormRow } from "component/form.js";
|
2017-06-03 01:09:52 +02:00
|
|
|
|
2017-06-09 02:10:53 +02:00
|
|
|
class UserEmailVerify extends React.PureComponent {
|
2017-06-03 01:09:52 +02:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2017-06-08 23:15:34 +02:00
|
|
|
code: "",
|
2017-06-03 01:09:52 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
handleCodeChanged(event) {
|
|
|
|
this.setState({
|
|
|
|
code: event.target.value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
handleSubmit(event) {
|
|
|
|
event.preventDefault();
|
2017-06-08 23:15:34 +02:00
|
|
|
this.props.verifyUserEmail(this.state.code);
|
2017-06-03 01:09:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-06-08 23:15:34 +02:00
|
|
|
const { errorMessage, isPending } = this.props;
|
2017-06-03 01:09:52 +02:00
|
|
|
|
2017-06-08 23:15:34 +02:00
|
|
|
return (
|
|
|
|
<form
|
|
|
|
className="form-input-width"
|
|
|
|
onSubmit={event => {
|
|
|
|
this.handleSubmit(event);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<FormRow
|
|
|
|
type="text"
|
|
|
|
label="Verification Code"
|
|
|
|
placeholder="a94bXXXXXXXXXXXXXX"
|
|
|
|
name="code"
|
|
|
|
value={this.state.code}
|
|
|
|
onChange={event => {
|
|
|
|
this.handleCodeChanged(event);
|
|
|
|
}}
|
|
|
|
errorMessage={errorMessage}
|
|
|
|
/>
|
|
|
|
{/* render help separately so it always shows */}
|
|
|
|
<div className="form-field__helper">
|
|
|
|
<p>
|
|
|
|
Email <Link href="mailto:help@lbry.io" label="help@lbry.io" /> if
|
|
|
|
you did not receive or are having trouble with your code.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div className="form-row-submit form-row-submit--with-footer">
|
|
|
|
<Link
|
|
|
|
button="primary"
|
|
|
|
label="Verify"
|
|
|
|
disabled={this.state.submitting}
|
|
|
|
onClick={event => {
|
|
|
|
this.handleSubmit(event);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
);
|
2017-06-03 01:09:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-08 23:15:34 +02:00
|
|
|
export default UserEmailVerify;
|