mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-13 19:46:53 +00:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user