Skip to content

Commit b7d6f1a

Browse files
author
Boopathi
committed
Refactor authProvider: only 'local' and 'google' allowed; normalize 'password' to 'local'; remove 'linkedin' from all dashboards and login flow.
1 parent 276d2e2 commit b7d6f1a

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

src/components/auth/login-modal.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ export default function LoginModal({ isOpen, setIsOpen, onLoginSuccess }: LoginM
109109
return;
110110
}
111111
if (response.ok) {
112-
toast({ title: "Login Successful", description: `Welcome back, ${data.name || firebaseUser.displayName || firebaseUser.email}!` });
112+
const normalizedAuthProvider = data.authProvider === 'password' ? 'local' : data.authProvider || 'local';
113113
onLoginSuccess({
114114
role: data.role || 'founder',
115115
token: data.token || idToken,
116116
hasSubscription: data.hasSubscription || false,
117117
name: data.name || firebaseUser.displayName || '',
118118
email: data.email || firebaseUser.email || '',
119-
authProvider: data.authProvider || 'local',
119+
authProvider: normalizedAuthProvider,
120120
});
121121
return;
122122
} else {
@@ -155,14 +155,13 @@ export default function LoginModal({ isOpen, setIsOpen, onLoginSuccess }: LoginM
155155
return;
156156
}
157157
if (response.ok) {
158-
toast({ title: "Login Successful", description: `Welcome back, ${data.name || result.user.displayName || result.user.email}!` });
159158
onLoginSuccess({
160159
role: data.role || 'founder',
161160
token: data.token || idToken,
162161
hasSubscription: data.hasSubscription || false,
163162
name: data.name || result.user.displayName || '',
164163
email: data.email || result.user.email || '',
165-
authProvider: data.authProvider || 'google',
164+
authProvider: 'google',
166165
});
167166
} else {
168167
toast({ variant: 'destructive', title: 'Login Failed', description: data.error || 'An error occurred.' });

src/components/views/dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type ProgramFormValues = z.infer<typeof programSchema>;
6363

6464

6565
type User = { name: string; email: string; }
66-
type AuthProvider = 'local' | 'google' | 'linkedin';
66+
type AuthProvider = 'local' | 'google';
6767

6868
interface DashboardViewProps {
6969
isOpen: boolean;

src/components/views/incubator-dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type User = {
3030
name: string;
3131
email: string;
3232
}
33-
type AuthProvider = 'local' | 'google' | 'linkedin';
33+
type AuthProvider = 'local' | 'google';
3434

3535

3636
const profileFormSchema = z.object({

src/components/views/main-view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type User = {
4040
name: string;
4141
email: string;
4242
}
43-
type AuthProvider = 'local' | 'google' | 'linkedin';
43+
type AuthProvider = 'local' | 'google';
4444

4545
export default function MainView() {
4646
const [theme, setTheme] = useState<'light' | 'dark' | null>(null);

src/components/views/mentor-dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type User = {
3131
name: string;
3232
email: string;
3333
}
34-
type AuthProvider = 'local' | 'google' | 'linkedin';
34+
type AuthProvider = 'local' | 'google';
3535

3636
const profileFormSchema = z.object({
3737
name: z.string().min(1, "Name is required"),

src/components/views/msme-dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type User = {
3030
name: string;
3131
email: string;
3232
}
33-
type AuthProvider = 'local' | 'google' | 'linkedin';
33+
type AuthProvider = 'local' | 'google';
3434

3535
// Profile form schema
3636
const profileFormSchema = z.object({

0 commit comments

Comments
 (0)