Skip to content

Commit

Permalink
Version final-0
Browse files Browse the repository at this point in the history
  • Loading branch information
Galenso Serrano committed Jan 18, 2025
1 parent f6f3602 commit 32899ba
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion routes/authRouters.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ router.get('/validate-token',
}
const loginUser=req.user.dataValues.nick
console.log("el usuario es:",req.user.dataValues.nick)
res.status(200).json({ message: 'Token válido',loginUser});
res.status(200).json({ message: 'Token válido+',loginUser});
}
catch(err){
console.error('Error al validar el token:', err.message || err);
Expand Down
13 changes: 6 additions & 7 deletions src/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,12 @@ async function likeMovie(type,movie) {
export async function isAuthenticated() {
try {
const response = await axiosInstance.get('/auth/validate-token');
console.log(response)
// const portada = document.getElementById("portada");
// const titleNick= document.createElement("h1")
// titleNick.classList.add("titleNick")
// const nickName=response
// titleNick.textContent=nickName
// portada.appendChild(titleNick)
const portada = document.getElementById("portada");
const titleNick= document.createElement("h1")
titleNick.classList.add("titleNick")
const nickName=response.data.loginUser
titleNick.textContent=nickName
portada.appendChild(titleNick)
return response.status === 200; // Si el servidor responde con un 200, el token es válido
} catch (error) {
console.error('Token inválido o expirado:', error.message || 'Error de red');
Expand Down
6 changes: 1 addition & 5 deletions src/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,10 @@ async function portadaBlackMirror() {
btnSign.classList.add("inactive")
btnInicio.classList.add("inactive")
btnSalir.classList.remove("inactive")


// titleNick.classList.remove("inactive")
}else{
}else{
btnSign.classList.remove("inactive")
btnInicio.classList.remove("inactive")
btnSalir.classList.add("inactive")
// titleNick.classList.add("inactive")
console.log('Usuario no autenticado. No se cargarán las listas de favoritos.');
}
})
Expand Down
22 changes: 18 additions & 4 deletions src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ display: flex;
font-weight: 700;
letter-spacing: 0.02em;
position: absolute;
left: 95%;
left: 88%;
text-shadow: 0 0 .15em #910a67;
top: 118%;
user-select: none;
Expand Down Expand Up @@ -674,7 +674,7 @@ select::after {
cursor: pointer;
border-radius: 25px;
}
#btnUserLog,#btnUserLogOut{
#btnUserLog{
background: #151515;
color: #fff;
font-size: 1.2em;
Expand All @@ -685,6 +685,17 @@ select::after {
left: 88%;
border-radius: 25px;
}
#btnUserLogOut{
background: #151515;
color: #fff;
font-size: 1.2em;
font-variant: small-caps;
cursor: pointer;
position: absolute;
top: 140%;
left: 103%;
border-radius: 25px;
}
.in{
background: #66b14b;
color: #fff;
Expand Down Expand Up @@ -861,7 +872,10 @@ select::after {
margin-top: 6em;
flex-wrap: wrap;
}

.titleNick {
left: 2%;
top: 89%;
}
.likedH1C {
margin-top: 7em;
left: 3cqmin;
Expand Down Expand Up @@ -911,7 +925,7 @@ select::after {
}
#btnUserLogOut{
top: 115%;
left: 40%;
left: 71%;
}
#btnUserSign{
top: 115%;
Expand Down
4 changes: 0 additions & 4 deletions utils/auth/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
const passport=require("passport")
const LocalStartegy=require("./strategies/localStrategy")
// const JwtStrategy=require("./strategies/jwtStrategy")

passport.use("local",LocalStartegy)
// passport.use("jwt",JwtStrategy)

const Strategy = require('passport-jwt').Strategy;
const {User}=require("../../db/model/userModel")
// const userService = require ("../../services/usersService")
const {config}=require("../../config/config")
// const service = new userService
const cookieExtractor = (req) => {
let token = null;
if (req && req.cookies) {
Expand Down

0 comments on commit 32899ba

Please sign in to comment.