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,6 +112,8 @@ 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>
|
||||||
|
|
||||||
|
{props.show_signup ?
|
||||||
|
<>
|
||||||
<Form.Group widths='equal'>
|
<Form.Group widths='equal'>
|
||||||
<Form.Input
|
<Form.Input
|
||||||
label='First Name'
|
label='First Name'
|
||||||
|
@ -180,6 +182,22 @@ export function SignupForm(props) {
|
||||||
<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