Explain when people need to sign up for Spaceport

This commit is contained in:
Tanner Collin 2021-11-11 06:05:24 +00:00
parent b8dc5467d8
commit 64e7f4d8f4
3 changed files with 51 additions and 15 deletions

View File

@ -84,6 +84,21 @@ class TransactionSerializer(serializers.ModelSerializer):
member = get_object_or_404(models.Member, id=validated_data['member_id']) member = get_object_or_404(models.Member, id=validated_data['member_id'])
if member.user: if member.user:
validated_data['user'] = member.user validated_data['user'] = member.user
if validated_data['account_type'] != 'Clearing':
if validated_data['amount'] == 0:
raise ValidationError(dict(account_type='You can\'t have a $0 {} transaction. Do you want "Membership Adjustment"?'.format(validated_data['account_type'])))
elif validated_data['amount'] < 0.1:
raise ValidationError(dict(amount='Don\'t try and trick me.'))
if validated_data['account_type'] == 'PayPal':
msg = 'Manual PayPal transaction added:\n' + str(validated_data)
utils.alert_tanner(msg)
if validated_data['account_type'] in ['Interac', 'Dream Pmt', 'Square Pmt', 'PayPal']:
if not validated_data.get('reference_number', None):
raise ValidationError(dict(reference_number='This field is required.'))
return super().create(validated_data) return super().create(validated_data)
def update(self, instance, validated_data): def update(self, instance, validated_data):
@ -632,8 +647,12 @@ class MyPasswordChangeSerializer(PasswordChangeSerializer):
class MyPasswordResetSerializer(PasswordResetSerializer): class MyPasswordResetSerializer(PasswordResetSerializer):
def validate_email(self, email): def validate_email(self, email):
if not User.objects.filter(email__iexact=email).exists(): if not User.objects.filter(email__iexact=email).exists():
logging.info('Email not found: ' + email) if models.Member.objects.filter(old_email__iexact=email).exists():
raise ValidationError('Not found.') logging.info('Email hasn\'t migrated to Spaceport yet: ' + email)
raise ValidationError('Not on Spaceport.')
else:
logging.info('Email not found: ' + email)
raise ValidationError('Not found.')
return super().validate_email(email) return super().validate_email(email)
def save(self): def save(self):

View File

@ -40,11 +40,6 @@ export function LoginForm(props) {
> >
<Header size='medium'>Log In to Spaceport</Header> <Header size='medium'>Log In to Spaceport</Header>
<Message warning>
<Message.Header>First time at the new portal?</Message.Header>
<p>Sign up below from Protospace Wi-Fi / computers.</p>
</Message>
<Form.Input <Form.Input
label='Username' label='Username'
name='username' name='username'
@ -109,6 +104,11 @@ export function SignupForm(props) {
const interval = setInterval(getStatus, 500); const interval = setInterval(getStatus, 500);
const data = { ...input, email: input.email.toLowerCase(), bypass_code: bypass_code, request_id: request_id }; const data = { ...input, email: input.email.toLowerCase(), bypass_code: bypass_code, request_id: request_id };
if (bypass_code) {
data.existing_member = true;
}
requester('/registration/', 'POST', '', data) requester('/registration/', 'POST', '', data)
.then(res => { .then(res => {
clearInterval(interval); clearInterval(interval);
@ -161,7 +161,7 @@ export function SignupForm(props) {
error={error.email} error={error.email}
/> />
<Form.Group grouped> {!!bypass_code || <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'
@ -178,7 +178,7 @@ export function SignupForm(props) {
onChange={handleValues} onChange={handleValues}
error={!!error.existing_member} error={!!error.existing_member}
/> />
</Form.Group> </Form.Group>}
<Form.Input <Form.Input
label='Password' label='Password'

View File

@ -37,7 +37,7 @@ function ResetForm() {
}); });
return ( return (
<Form onSubmit={handleSubmit} error={error.email == 'Not found.'}> <Form onSubmit={handleSubmit} error={!!error.email}>
<Form.Input <Form.Input
label='Email' label='Email'
name='email' name='email'
@ -45,11 +45,28 @@ function ResetForm() {
error={error.email} error={error.email}
/> />
<Message {error.email == 'Not found.' &&
error <Message
header='Email not found in Spaceport' error
content='Ask a director if you forgot which one you used.' header='Email not found in Spaceport'
/> content='Ask a director if you forgot which one you used.'
/>
}
{error.email == 'Not on Spaceport.' &&
<Message
error
header={'You haven\'t registered to Spaceport yet'}
content={
<>
Please sign up to the new portal here:<br />
<Link to='/#outside-protospace-15c7b5'>
Spaceport Registration
</Link>
</>
}
/>
}
<Form.Button loading={loading} error={error.non_field_errors}> <Form.Button loading={loading} error={error.non_field_errors}>
Submit Submit