first-deploy #72
@@ -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';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user