Make email required in claim code form

This commit is contained in:
alexliebowitz 2016-07-04 14:55:18 -04:00 committed by GitHub
parent 8d9f793275
commit f06c0e7c1b

View file

@ -13,12 +13,14 @@ var claimCodePageStyle = {
var ClaimCodePage = React.createClass({ var ClaimCodePage = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
submitting: false, i submitting: false,
} }
}, },
handleSubmit: function() { handleSubmit: function() {
if (!this.refs.code.value) { if (!this.refs.code.value) {
alert('Please enter an invitation code or choose "Skip."') alert('Please enter an invitation code or choose "Skip."');
} else if (!this.refs.email.value) {
alert('Please enter an email address or choose "Skip."');
} }
this.setState({ this.setState({
@ -56,7 +58,7 @@ var ClaimCodePage = React.createClass({
xhr.open('POST', 'https://invites.lbry.io', true); xhr.open('POST', 'https://invites.lbry.io', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.send('code=' + code + '&address=' + address + (email ? ('&email=' + email) : '')); xhr.send('code=' + code + '&address=' + address + '&email=' + email);
}); });
}, },
handleSkip: function() { handleSkip: function() {
@ -68,9 +70,9 @@ var ClaimCodePage = React.createClass({
<main className="page" style={claimCodePageStyle}> <main className="page" style={claimCodePageStyle}>
<h1>Claim your beta invitation code</h1> <h1>Claim your beta invitation code</h1>
<section style={claimCodeContentStyle}> <section style={claimCodeContentStyle}>
<p>Thanks for beta testing LBRY! Enter your invitation code below to receive your 200 free LBRY credits.</p> <p>Thanks for beta testing LBRY! Enter your invitation code and email address below to receive your 200 free
<p>You may also enter your email address. This will add you to our mailing list (if you're not already on it) LBRY credits.</p>
as well as making you eligible for future rewards for beta testers.</p> <p>You will be added to our mailing list (if you're not already on it) and will be eligible for future rewards for beta testers.</p>
</section> </section>
<section> <section>
<form> <form>
@ -86,4 +88,4 @@ var ClaimCodePage = React.createClass({
</main> </main>
); );
} }
}); });