I can't believe it but I have sign in with Microsoft working!
This commit is contained in:
@@ -8,13 +8,14 @@ import {
|
||||
import { api } from './_generated/api';
|
||||
import { type Id } from './_generated/dataModel';
|
||||
import { action, mutation, query } from './_generated/server';
|
||||
import Password from './CustomPassword';
|
||||
import Authentik from '@auth/core/providers/authentik';
|
||||
import { Entra, Password, validatePassword, } from './custom/auth';
|
||||
|
||||
export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
|
||||
providers: [
|
||||
Password,
|
||||
Authentik,
|
||||
Entra,
|
||||
],
|
||||
});
|
||||
|
||||
@@ -42,6 +43,20 @@ export const getUser = query(async (ctx) => {
|
||||
};
|
||||
});
|
||||
|
||||
// Add this temporarily to packages/backend/convex/auth.ts
|
||||
export const debugMicrosoftConfig = action({
|
||||
args: {},
|
||||
handler: async (ctx, args) => {
|
||||
console.log('Microsoft Entra ID Config Debug:', {
|
||||
issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER,
|
||||
clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID,
|
||||
hasSecret: !!process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
|
||||
secretLength: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET?.length,
|
||||
});
|
||||
return { logged: true };
|
||||
},
|
||||
});
|
||||
|
||||
export const getAllUsers = query(async (ctx) => {
|
||||
const users = await ctx.db.query('users').collect();
|
||||
return users.map((u) => ({
|
||||
@@ -133,19 +148,6 @@ export const updateUserAutomaticLunch = mutation({
|
||||
},
|
||||
});
|
||||
|
||||
export const validatePassword = (password: string): boolean => {
|
||||
if (
|
||||
password.length < 8 ||
|
||||
password.length > 100 ||
|
||||
!/\d/.test(password) ||
|
||||
!/[a-z]/.test(password) ||
|
||||
!/[A-Z]/.test(password)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export const updateUserPassword = action({
|
||||
args: {
|
||||
currentPassword: v.string(),
|
||||
|
Reference in New Issue
Block a user