Hide Sign Up form from IPs outside Protospace
This commit is contained in:
parent
ccd44a063b
commit
1f5f99c971
|
@ -502,6 +502,8 @@ class StatsViewSet(viewsets.ViewSet, List):
|
||||||
if not user.is_authenticated or not user.member.vetted_date:
|
if not user.is_authenticated or not user.member.vetted_date:
|
||||||
stats.pop('alarm', None)
|
stats.pop('alarm', None)
|
||||||
|
|
||||||
|
stats['at_protospace'] = utils.is_request_from_protospace(request)
|
||||||
|
|
||||||
return Response(stats)
|
return Response(stats)
|
||||||
|
|
||||||
@action(detail=False, methods=['post'])
|
@action(detail=False, methods=['post'])
|
||||||
|
|
|
@ -166,6 +166,8 @@ export function Home(props) {
|
||||||
|
|
||||||
const alarmStat = () => stats && stats.alarm && moment().unix() - stats.alarm['time'] < 300 ? stats.alarm['data'] < 270 ? 'Armed' : 'Disarmed' : 'Unknown';
|
const alarmStat = () => stats && stats.alarm && moment().unix() - stats.alarm['time'] < 300 ? stats.alarm['data'] < 270 ? 'Armed' : 'Disarmed' : 'Unknown';
|
||||||
|
|
||||||
|
const show_signup = stats?.at_protospace || bypass_code;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Grid stackable padded columns={2}>
|
<Grid stackable padded columns={2}>
|
||||||
|
@ -197,7 +199,7 @@ export function Home(props) {
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
<SignupForm {...props} />
|
<SignupForm {...props} show_signup={show_signup} />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
|
|
|
@ -112,74 +112,92 @@ export function SignupForm(props) {
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<Header size='medium'>Sign Up to Spaceport</Header>
|
<Header size='medium'>Sign Up to Spaceport</Header>
|
||||||
|
|
||||||
<Form.Group widths='equal'>
|
{props.show_signup ?
|
||||||
<Form.Input
|
<>
|
||||||
label='First Name'
|
<Form.Group widths='equal'>
|
||||||
name='first_name'
|
<Form.Input
|
||||||
fluid
|
label='First Name'
|
||||||
onChange={handleChange}
|
name='first_name'
|
||||||
error={error.first_name}
|
fluid
|
||||||
/>
|
onChange={handleChange}
|
||||||
<Form.Input
|
error={error.first_name}
|
||||||
label='Last Name'
|
/>
|
||||||
name='last_name'
|
<Form.Input
|
||||||
fluid
|
label='Last Name'
|
||||||
onChange={handleChange}
|
name='last_name'
|
||||||
error={error.last_name}
|
fluid
|
||||||
/>
|
onChange={handleChange}
|
||||||
</Form.Group>
|
error={error.last_name}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
<Form.Input
|
<Form.Input
|
||||||
label='Username'
|
label='Username'
|
||||||
name='username'
|
name='username'
|
||||||
value={genUsername()}
|
value={genUsername()}
|
||||||
error={error.username}
|
error={error.username}
|
||||||
readOnly
|
readOnly
|
||||||
/>
|
/>
|
||||||
<Form.Input
|
<Form.Input
|
||||||
label='Email'
|
label='Email'
|
||||||
name='email'
|
name='email'
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={error.email}
|
error={error.email}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Form.Group grouped>
|
<Form.Group grouped>
|
||||||
<Form.Radio
|
<Form.Radio
|
||||||
label='I have an account on the old portal'
|
label='I have an account on the old portal'
|
||||||
name='existing_member'
|
name='existing_member'
|
||||||
value={'true'}
|
value={'true'}
|
||||||
checked={input.existing_member === 'true'}
|
checked={input.existing_member === 'true'}
|
||||||
onChange={handleValues}
|
onChange={handleValues}
|
||||||
error={!!error.existing_member}
|
error={!!error.existing_member}
|
||||||
/>
|
/>
|
||||||
<Form.Radio
|
<Form.Radio
|
||||||
label='I am new to Protospace'
|
label='I am new to Protospace'
|
||||||
name='existing_member'
|
name='existing_member'
|
||||||
value={'false'}
|
value={'false'}
|
||||||
checked={input.existing_member === 'false'}
|
checked={input.existing_member === 'false'}
|
||||||
onChange={handleValues}
|
onChange={handleValues}
|
||||||
error={!!error.existing_member}
|
error={!!error.existing_member}
|
||||||
/>
|
/>
|
||||||
</Form.Group>
|
</Form.Group>
|
||||||
|
|
||||||
<Form.Input
|
<Form.Input
|
||||||
label='Password'
|
label='Password'
|
||||||
name='password1'
|
name='password1'
|
||||||
type='password'
|
type='password'
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={error.password1}
|
error={error.password1}
|
||||||
/>
|
/>
|
||||||
<Form.Input
|
<Form.Input
|
||||||
label='Confirm Password'
|
label='Confirm Password'
|
||||||
name='password2'
|
name='password2'
|
||||||
type='password'
|
type='password'
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={error.password2}
|
error={error.password2}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Form.Button loading={loading} error={error.non_field_errors}>
|
<Form.Button loading={loading} error={error.non_field_errors}>
|
||||||
Sign Up
|
Sign Up
|
||||||
</Form.Button>
|
</Form.Button>
|
||||||
|
</>
|
||||||
|
:
|
||||||
|
<>
|
||||||
|
<Message info>
|
||||||
|
<Message.Header>Please Visit Protospace</Message.Header>
|
||||||
|
<p>You'll need to sign a waiver and fill out member forms.</p>
|
||||||
|
</Message>
|
||||||
|
<p>
|
||||||
|
Our address: <br />
|
||||||
|
1530 27th Avenue NE <br />
|
||||||
|
Bay 108 <br />
|
||||||
|
Calgary, Alberta, Canada
|
||||||
|
</p>
|
||||||
|
<p><a href="https://goo.gl/maps/u1NeC71HzUEUhe7N9" target="_blank">Google Maps Link</a></p>
|
||||||
|
</>
|
||||||
|
}
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user