Want to remove reset password field if provider is not password. almost there

This commit is contained in:
2025-09-19 16:57:59 -05:00
parent fd2999e9bb
commit 45d2461781

View File

@@ -33,28 +33,29 @@ export const getUser = query(async (ctx) => {
typeof user.image === 'string' && user.image.length > 0 typeof user.image === 'string' && user.image.length > 0
? (user.image as Id<'_storage'>) ? (user.image as Id<'_storage'>)
: null; : null;
const authAccount = await ctx.db
.query('authAccounts')
.withIndex('userIdAndProvider', (q) => q.eq('userId', userId))
.first();
return { return {
id: user._id, id: user._id,
email: user.email ?? null, email: user?.email,
name: user.name ?? null, name: user?.name,
image, image,
lunchTime: user.lunchTime ?? null, lunchTime: user?.lunchTime,
automaticLunch: user.automaticLunch ?? false, automaticLunch: user.automaticLunch,
provider: authAccount?.provider,
}; };
}); });
// Add this temporarily to packages/backend/convex/auth.ts export const getUserAuthAccount = query(async (ctx) => {
export const debugMicrosoftConfig = action({ const userId = await getAuthUserId(ctx);
args: {}, if (!userId) return null;
handler: async (ctx, args) => { const authAccount = await ctx.db
console.log('Microsoft Entra ID Config Debug:', { .query('authAccounts')
issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER, .withIndex('userIdAndProvider', (q) => q.eq('userId', userId))
clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID, .first();
hasSecret: !!process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET, return authAccount;
secretLength: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET?.length,
});
return { logged: true };
},
}); });
export const getAllUsers = query(async (ctx) => { export const getAllUsers = query(async (ctx) => {