auth: training notice on login and registration; registration needs an acknowledgement
One TrainingNotice component above the submit button on both screens. Login shows the notice only; registration adds a ticked checkbox that gates the Register button. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8774cbbe45
commit
4e2aeddb69
3 changed files with 56 additions and 1 deletions
45
src/app/pages/auth/TrainingNotice.tsx
Normal file
45
src/app/pages/auth/TrainingNotice.tsx
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Box, Checkbox, Text, color, config } from 'folds';
|
||||
import React from 'react';
|
||||
|
||||
export const TRAINING_NOTICE =
|
||||
"Everything said on this server may be used to train GameCult's AI stewards. We never ingest Discord content.";
|
||||
|
||||
type TrainingNoticeProps = {
|
||||
// Registration passes this to require a ticked acknowledgement; login shows the notice only.
|
||||
acknowledge?: { checked: boolean; onToggle: () => void };
|
||||
};
|
||||
|
||||
export function TrainingNotice({ acknowledge }: TrainingNoticeProps) {
|
||||
return (
|
||||
<Box
|
||||
direction="Column"
|
||||
gap="200"
|
||||
style={{
|
||||
padding: config.space.S300,
|
||||
borderRadius: config.radii.R300,
|
||||
backgroundColor: color.SurfaceVariant.Container,
|
||||
color: color.SurfaceVariant.OnContainer,
|
||||
border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
|
||||
}}
|
||||
>
|
||||
<Text size="T300">{TRAINING_NOTICE}</Text>
|
||||
{acknowledge && (
|
||||
<Text
|
||||
as="label"
|
||||
size="T300"
|
||||
style={{ display: 'flex', alignItems: 'center', gap: config.space.S200 }}
|
||||
>
|
||||
<Checkbox
|
||||
name="trainingAck"
|
||||
size="300"
|
||||
variant="Primary"
|
||||
required
|
||||
checked={acknowledge.checked}
|
||||
onClick={acknowledge.onToggle}
|
||||
/>
|
||||
I understand and agree.
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ import {
|
|||
} from './loginUtil';
|
||||
import { PasswordInput } from '../../../components/password-input';
|
||||
import { FieldError } from '../FiledError';
|
||||
import { TrainingNotice } from '../TrainingNotice';
|
||||
import { getResetPasswordPath } from '../../pathUtils';
|
||||
import { stopPropagation } from '../../../utils/keyboard';
|
||||
|
||||
|
|
@ -255,6 +256,7 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
|
|||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
<TrainingNotice />
|
||||
<Button type="submit" variant="Primary" size="500">
|
||||
<Text as="span" size="B500">
|
||||
Login
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import { AsyncState, AsyncStatus, useAsyncCallback } from '../../../hooks/useAsy
|
|||
import { useAutoDiscoveryInfo } from '../../../hooks/useAutoDiscoveryInfo';
|
||||
import { RegisterError, RegisterResult, register, useRegisterComplete } from './registerUtil';
|
||||
import { FieldError } from '../FiledError';
|
||||
import { TrainingNotice } from '../TrainingNotice';
|
||||
import {
|
||||
AutoDummyStageDialog,
|
||||
AutoTermsStageDialog,
|
||||
|
|
@ -192,6 +193,7 @@ export function PasswordRegisterForm({
|
|||
const [formData, setFormData] = useState<FormData>();
|
||||
|
||||
const [ongoingFlow, setOngoingFlow] = useState<UIAFlow>();
|
||||
const [trainingAck, setTrainingAck] = useState(false);
|
||||
|
||||
const [registerEmailState, registerEmail] = useRegisterEmail(mx);
|
||||
|
||||
|
|
@ -389,7 +391,13 @@ export function PasswordRegisterForm({
|
|||
<FieldError message={registerError.data.error ?? 'Failed to register. Unknown Reason.'} />
|
||||
)}
|
||||
<span data-spacing-node />
|
||||
<Button variant="Primary" size="500" type="submit">
|
||||
<TrainingNotice
|
||||
acknowledge={{
|
||||
checked: trainingAck,
|
||||
onToggle: () => setTrainingAck((ack) => !ack),
|
||||
}}
|
||||
/>
|
||||
<Button variant="Primary" size="500" type="submit" disabled={!trainingAck}>
|
||||
<Text as="span" size="B500">
|
||||
Register
|
||||
</Text>
|
||||
|
|
|
|||
Loading…
Reference in a new issue