lbry-desktop/ui/js/component/userEmailVerify/view.jsx

68 lines
1.6 KiB
React
Raw Normal View History

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
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({
2017-07-19 01:00:13 +02:00
code: String(event.target.value).trim(),
2017-06-03 01:09:52 +02:00
});
}
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;
return (
<form
onSubmit={event => {
this.handleSubmit(event);
}}
>
2017-07-19 01:00:13 +02:00
<p>{__("Please enter the verification code emailed to you.")}</p>
2017-06-08 23:15:34 +02:00
<FormRow
type="text"
2017-06-19 14:42:24 +02:00
label={__("Verification Code")}
2017-06-08 23:15:34 +02:00
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>
2017-07-28 03:13:12 +02:00
{__("Email")}{" "}
2017-06-20 14:08:52 +02:00
<Link href="mailto:help@lbry.io" label="help@lbry.io" />{" "}
2017-07-28 03:13:12 +02:00
{__("if you encounter any trouble with your code.")}
2017-06-08 23:15:34 +02:00
</p>
</div>
<div className="form-row-submit form-row-submit--with-footer">
<Link
button="primary"
2017-06-19 14:42:24 +02:00
label={__("Verify")}
2017-06-08 23:15:34 +02:00
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;