diff --git a/cosiap_api/cosiap_api/settings.py b/cosiap_api/cosiap_api/settings.py
index 3341e2c6470c2adc1d3056f4f29d1f97a06dbf37..ac1f99cdaaffd620a1e9d193e784c14210ee8125 100644
--- a/cosiap_api/cosiap_api/settings.py
+++ b/cosiap_api/cosiap_api/settings.py
@@ -192,8 +192,8 @@ SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SIMPLE_JWT = {
- 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=0.5),
- 'REFRESH_TOKEN_LIFETIME': timedelta(minutes=1),
+ 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=3),
+ 'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'ROTATE_REFRESH_TOKENS': False,
'BLACKLIST_AFTER_ROTATION': False,
'ALGORITHM': 'HS256',
diff --git a/cosiap_frontend/src/App.jsx b/cosiap_frontend/src/App.jsx
index 5590358c2306683ecd690a7ff706f3ce4ef8005d..adbdd3f4af79dd93356bfe10a13f8ff162fc176f 100644
--- a/cosiap_frontend/src/App.jsx
+++ b/cosiap_frontend/src/App.jsx
@@ -1,4 +1,3 @@
-import React, { useEffect, useState } from "react";
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import {PaginaHead} from "@/components/common/utility/PaginaHead";
import {Autenticador} from "@/components/common/utility/Autenticador";
@@ -6,7 +5,7 @@ import {LoginRequiredRoutes} from "@/components/common/utility/LoginRequiredRout
import "./App.css";
import { AuthPage } from "./components/users/AuthPage";
-import {InicioTest} from './components/users/InicioTest';
+import Inicio from "./components/users/Inicio";
function App() {
@@ -27,7 +26,7 @@ function App() {
{/* Rutas protegidas */}
}>
- } />
+ } />
diff --git a/cosiap_frontend/src/components/common/layouts/LayoutBaseAuthenticator.jsx b/cosiap_frontend/src/components/common/layouts/LayoutBaseAuthenticator.jsx
index 53e85fc28a7ea414c09770b1833881d091ab1f3f..99c83437b3bd6769b9bbb3bb36f4188440349de8 100644
--- a/cosiap_frontend/src/components/common/layouts/LayoutBaseAuthenticator.jsx
+++ b/cosiap_frontend/src/components/common/layouts/LayoutBaseAuthenticator.jsx
@@ -25,7 +25,7 @@ export default function LayoutBaseAuthenticator({title, children}) {
{
const contextoAut = useContext(ContextoAut);
-
if (!contextoAut) {
throw new Error(
"useAutenticacion se tiene que usar dentro de un componente autenticador"
@@ -77,7 +76,7 @@ export const Autenticador = ({ children }) => {
};
});
return (
-
+
{children}
);
diff --git a/cosiap_frontend/src/components/common/utility/LoginRequiredRoutes.jsx b/cosiap_frontend/src/components/common/utility/LoginRequiredRoutes.jsx
index 627f5d7b14dbf5adddc3bf50e926c4c12cc915b9..b9219626ad61725287116784992e90e70dbaff4d 100644
--- a/cosiap_frontend/src/components/common/utility/LoginRequiredRoutes.jsx
+++ b/cosiap_frontend/src/components/common/utility/LoginRequiredRoutes.jsx
@@ -5,7 +5,7 @@ export const LoginRequiredRoutes = () => {
const { token } = useAutenticacion();
if (token === null) {
- return ;
+ return ;
} else if (token === undefined) {
return null; // O un spinner de carga o marcador de posición
} else {
@@ -13,4 +13,4 @@ export const LoginRequiredRoutes = () => {
}
};
-export default LoginRequiredRoutes;
+export default LoginRequiredRoutes;
\ No newline at end of file
diff --git a/cosiap_frontend/src/components/users/Inicio.jsx b/cosiap_frontend/src/components/users/Inicio.jsx
new file mode 100644
index 0000000000000000000000000000000000000000..a6d7e7b249788f4f0156613eb3d0f1b01cbb1e97
--- /dev/null
+++ b/cosiap_frontend/src/components/users/Inicio.jsx
@@ -0,0 +1,7 @@
+export default function Inicio() {
+ return (
+
+
Inicio
+
+ );
+}
diff --git a/cosiap_frontend/src/components/users/InicioTest.jsx b/cosiap_frontend/src/components/users/InicioTest.jsx
deleted file mode 100644
index 9b6e9e1b2c67147352215a24230b0ad14364817b..0000000000000000000000000000000000000000
--- a/cosiap_frontend/src/components/users/InicioTest.jsx
+++ /dev/null
@@ -1,11 +0,0 @@
-export const InicioTest = () => {
- return (
-
-
Inicio
- Inicio
- Inicio
- Inicio
- Inicio
-
- );
-}
diff --git a/cosiap_frontend/src/components/users/Login/LoginForm.jsx b/cosiap_frontend/src/components/users/Login/LoginForm.jsx
index c6d1a0b645810e597029cba4b05a3eaa29fcb435..a3344bbc0ff323a870e18bbcc7e4561c1bfff9e2 100644
--- a/cosiap_frontend/src/components/users/Login/LoginForm.jsx
+++ b/cosiap_frontend/src/components/users/Login/LoginForm.jsx
@@ -6,6 +6,8 @@ import {LoginInputCURP} from '@/components/users/Login/LoginInputCURP'
import { LoginInputPassword } from "@/components/users/Login/LoginInputPassword";
import { useState } from "react";
import {ErrorDisplay} from '@/components/common/ui/ErrorDisplay'
+import { useNavigate } from "react-router-dom";
+import {useAutenticacion} from "@/components/common/utility/Autenticador"
const CURP_REGEX = /^[A-Z]{1}[AEIOU]{1}[A-Z]{2}[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[HM]{1}(AS|BC|BS|CC|CH|CL|CM|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS|NE)[B-DF-HJ-NP-TV-Z]{3}[0-9A-Z]{1}[0-9]{1}$/;
@@ -18,6 +20,8 @@ const validationSchema = Yup.object({
export function LoginForm() {
const [loginError, setLoginError] = useState('')
+ const navigate = useNavigate();
+ const { setToken } = useAutenticacion();
const {
register,
handleSubmit,
@@ -26,11 +30,13 @@ export function LoginForm() {
resolver: yupResolver(validationSchema),
});
+
const onSubmit = async (data) => {
try {
const response = await api.usuarios.token.login(data);
- console.log("Login successful:", response.data);
- // Manejar la respuesta exitosa aquí
+ console.log("Login successful:", response.data);
+ setToken(response.data.access)
+ navigate("/inicio");
} catch (error) {
console.error("Login failed:", error);
setLoginError(error.response.data.detail)