2021-11-16 07:32:54 -05:00
|
|
|
import { html, Component } from "../lib/index.js";
|
|
|
|
import linkify from "../lib/linkify.js";
|
|
|
|
|
|
|
|
export default class RegisterForm extends Component {
|
|
|
|
state = {
|
|
|
|
code: "",
|
|
|
|
};
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2023-01-10 09:05:57 -05:00
|
|
|
this.handleInput = this.handleInput.bind(this);
|
2021-11-16 07:32:54 -05:00
|
|
|
this.handleSubmit = this.handleSubmit.bind(this);
|
|
|
|
}
|
|
|
|
|
2023-01-10 09:05:57 -05:00
|
|
|
handleInput(event) {
|
2021-11-16 07:32:54 -05:00
|
|
|
let target = event.target;
|
|
|
|
let value = target.type == "checkbox" ? target.checked : target.value;
|
|
|
|
this.setState({ [target.name]: value });
|
|
|
|
}
|
|
|
|
|
|
|
|
handleSubmit(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
this.props.onSubmit(this.state.code);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return html`
|
2023-01-10 09:05:57 -05:00
|
|
|
<form onInput=${this.handleInput} onSubmit=${this.handleSubmit}>
|
2021-11-30 09:49:52 -05:00
|
|
|
<p>Your account <strong>${this.props.account}</strong> has been created, but a verification code is required to complete the registration.</p>
|
|
|
|
|
|
|
|
<p>${linkify(this.props.message)}</p>
|
2021-11-16 07:32:54 -05:00
|
|
|
|
|
|
|
<label>
|
|
|
|
Verification code:<br/>
|
|
|
|
<input type="text" name="code" value=${this.state.code} required autofocus autocomplete="off"/>
|
|
|
|
</label>
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
<button>Verify account</button>
|
|
|
|
</form>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|