first-deploy #72

Merged
kilder merged 12 commits from first-deploy into master 2026-01-13 17:54:12 +00:00
38 changed files with 6826 additions and 906 deletions
Showing only changes of commit a4b8dd3f77 - Show all commits

View File

@@ -69,6 +69,7 @@
} }
const gpsPromise = coletarGPS(); const gpsPromise = coletarGPS();
const result = await authClient.signIn.email( const result = await authClient.signIn.email(
{ email: matricula.trim(), password: senha }, { email: matricula.trim(), password: senha },
{ {
@@ -163,7 +164,7 @@
} }
})(); })();
await goto(resolve(redirectAfterLogin as string), { replaceState: true }); await goto(resolve(redirectAfterLogin as any) as any, { replaceState: true });
} else { } else {
erroLogin = result.error?.message || 'Erro ao fazer login'; erroLogin = result.error?.message || 'Erro ao fazer login';
} }

View File

@@ -447,6 +447,7 @@ export const enforceRequest = mutation({
const ip = args.ip.trim(); const ip = args.ip.trim();
const path = args.path.trim() || '/'; const path = args.path.trim() || '/';
const pathKey = path.replace(/^\/+/, ''); const pathKey = path.replace(/^\/+/, '');
const isLoopback = ip === '::1' || ip === '127.0.0.1' || ip.startsWith('127.');
// 1) Blacklist enforcement (somente IP) // 1) Blacklist enforcement (somente IP)
const registroIp = await ctx.db const registroIp = await ctx.db
@@ -455,7 +456,16 @@ export const enforceRequest = mutation({
.order('desc') .order('desc')
.first(); .first();
if (registroIp && registroIp.categoria === 'ip' && registroIp.blacklist === true) { // NOTE: em desenvolvimento local, evitar bloquear loopback por blacklist,
// senão o login e a sessão (Better Auth) ficam impossíveis.
// Também priorizamos whitelist caso exista um registro marcado como ambos.
if (
registroIp &&
registroIp.categoria === 'ip' &&
registroIp.blacklist === true &&
registroIp.whitelist !== true &&
!isLoopback
) {
const ativo = !registroIp.bloqueadoAte || registroIp.bloqueadoAte > agora; const ativo = !registroIp.bloqueadoAte || registroIp.bloqueadoAte > agora;
if (ativo) { if (ativo) {
return { return {