Skip to content

Commit 0eac824

Browse files
committed
feat: Default cluster username to user’s email in the form
https://harperdb.atlassian.net/browse/STUDIO-436
1 parent 0ea98ff commit 0eac824

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/features/cluster/ClusterSetPassword.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from '@/features/instance/operations/mutations/useInstanceResetPasswordMutation';
1616
import { getInstanceUserInfo } from '@/features/instance/operations/queries/getInstanceUserInfo';
1717
import { AddUserFormSchema } from '@/features/instance/operations/schemas/addUserFormSchema';
18+
import { useCloudAuth } from '@/hooks/useAuth';
1819
import { authStore } from '@/lib/authStore';
1920
import { getOperationsUrlForCluster } from '@/lib/urls/getOperationsUrlForCluster';
2021
import { zodResolver } from '@hookform/resolvers/zod';
@@ -26,6 +27,7 @@ import { toast } from 'sonner';
2627
import { z } from 'zod';
2728

2829
export function ClusterSetPassword() {
30+
const { user } = useCloudAuth();
2931
const { clusterId }: { clusterId: string; } = useParams({ strict: false });
3032
const { data: cluster } = useQuery(
3133
getClusterInfoQueryOptions(clusterId, true),
@@ -44,7 +46,7 @@ export function ClusterSetPassword() {
4446
confirmPassword: '',
4547
password: '',
4648
role: 'super_user',
47-
username: '',
49+
username: user?.email ?? '',
4850
},
4951
});
5052
const tempPassword = cluster?.instances?.find(i => i.tempPassword)?.tempPassword;

0 commit comments

Comments
 (0)