Add organization selection to user registration

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/de2252c0-4da3-414b-97b5-948dbaef457c.jpg
This commit is contained in:
alphaeusmote
2025-04-10 00:02:06 +00:00
parent d032c95c17
commit 31ebf4abf3
2 changed files with 54 additions and 3 deletions
+29
View File
@@ -30,6 +30,7 @@ const registerSchema = z.object({
export default function AuthPage() {
const { user, loginMutation, registerMutation } = useAuth();
const { theme } = useTheme();
const { organizations, isLoading: orgsLoading } = useOrganization();
const loginForm = useForm<z.infer<typeof loginSchema>>({
resolver: zodResolver(loginSchema),
@@ -202,6 +203,34 @@ export default function AuthPage() {
</FormItem>
)}
/>
<FormField
control={registerForm.control}
name="organizationId"
render={({ field }) => (
<FormItem>
<FormLabel>Organization</FormLabel>
<FormControl>
<Select
disabled={orgsLoading}
onValueChange={(value) => field.onChange(parseInt(value))}
value={field.value?.toString() || ""}
>
<SelectTrigger>
<SelectValue placeholder="Select an organization (optional)" />
</SelectTrigger>
<SelectContent>
{organizations.map((org) => (
<SelectItem key={org.id} value={org.id.toString()}>
{org.name}
</SelectItem>
))}
</SelectContent>
</Select>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<Button
type="submit"
className="w-full"