Alugnos comentarios y ajustes al css y html de botones pdf.

master
vicsash 6 months ago
parent b7da5dc143
commit bcdb9c1217

@ -8,7 +8,9 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationSu
import java.io.IOException; import java.io.IOException;
public class CustomAuthenticacionHandler extends SimpleUrlAuthenticationSuccessHandler { public class CustomAuthenticacionHandler extends SimpleUrlAuthenticationSuccessHandler {
/**
* This method redirects to buscador after validation
*/
@Override @Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException { Authentication authentication) throws IOException, ServletException {

@ -7,6 +7,9 @@ import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration @Configuration
public class PasswordEcodingConf { public class PasswordEcodingConf {
/**
* This method encrypts the password with BCrypt
*/
@Bean @Bean
public PasswordEncoder passwordEncoder() { public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder(); return new BCryptPasswordEncoder();

@ -21,19 +21,23 @@ public class SecurityConfig{
private static final Logger logger = LoggerFactory.getLogger(SecurityConfig.class); private static final Logger logger = LoggerFactory.getLogger(SecurityConfig.class);
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private UsuarioService usuarioService;
@Autowired
private RolRepository rolService;
@Autowired @Autowired
private CustomAuth customAuth; private CustomAuth customAuth;
/**
* This method is used to configure the global AuthenticationManager.
*/
@Autowired @Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(customAuth); auth.authenticationProvider(customAuth);
} }
/**
* This bean is used to configure the security filter chain.
* The security filter chain is responsible for handling all security related tasks.
* It is the most important part of the Spring Security configuration.
* It is responsible for authenticating the user, authorizing the user, and handling the session.
*/
@Bean @Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
initializeAutoridadAndRolTables(); initializeAutoridadAndRolTables();
@ -67,6 +71,11 @@ public class SecurityConfig{
return new CustomAuthenticacionHandler(); return new CustomAuthenticacionHandler();
} }
/**
* This method is in charge of create the default roles, authorities and admin user.
* also uses method to instert some other information in the database. Skill, Sector, Family and Cycle
*/
private void initializeAutoridadAndRolTables() { private void initializeAutoridadAndRolTables() {
// Check if the autoridad table is empty // Check if the autoridad table is empty
Integer autoridadCount = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM autoridad", Integer.class); Integer autoridadCount = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM autoridad", Integer.class);

@ -6,7 +6,6 @@ import com.example.proyectofinal.servicios.empresa.AlumnoService;
import com.example.proyectofinal.servicios.empresa.CicloService; import com.example.proyectofinal.servicios.empresa.CicloService;
import com.example.proyectofinal.servicios.empresa.SkillService; import com.example.proyectofinal.servicios.empresa.SkillService;
import com.example.proyectofinal.servicios.user.UsuarioService; import com.example.proyectofinal.servicios.user.UsuarioService;
import jakarta.annotation.security.RolesAllowed;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -74,7 +73,6 @@ public class AlumnoController {
if(testIfExist != null){ if(testIfExist != null){
return new ResponseEntity<>("El alumno ya existe", HttpStatus.BAD_REQUEST); return new ResponseEntity<>("El alumno ya existe", HttpStatus.BAD_REQUEST);
} }
String password = "1234"; String password = "1234";
StringBuilder nombreUsuarioBuilder = new StringBuilder(); StringBuilder nombreUsuarioBuilder = new StringBuilder();
nombreUsuarioBuilder.append(alumno.getNombre().toLowerCase()); nombreUsuarioBuilder.append(alumno.getNombre().toLowerCase());
@ -142,10 +140,6 @@ public class AlumnoController {
nombreUsuarioBuilder.append(alumno.getApellido2().toLowerCase()); nombreUsuarioBuilder.append(alumno.getApellido2().toLowerCase());
} }
String nombreUsuario = nombreUsuarioBuilder.toString(); String nombreUsuario = nombreUsuarioBuilder.toString();
String nia = alumno.getNia();
String firstThreeLetters = nia.substring(0, 3);
String nombreLogIn="alu." +alumno.getNombre()+firstThreeLetters;
usuario.setNombreLogIn(nombreLogIn);
usuario.setNombreUsuario(nombreUsuario); usuario.setNombreUsuario(nombreUsuario);
usuarioService.saveUser(usuario); usuarioService.saveUser(usuario);

@ -33,7 +33,7 @@ public class MailService {
helper.setTo("empresas@ies.edu.es"); helper.setTo("empresas@ies.edu.es");
helper.setText(textMessage, true); helper.setText(textMessage, true);
helper.setSubject(subject); helper.setSubject(subject);
helper.setCc("victorsash96@gmail.com"); //helper.setCc(email);
emailSender.send(message); emailSender.send(message);
send = true; send = true;
LOGGER.info("Mail sent!"); LOGGER.info("Mail sent!");

@ -28,15 +28,11 @@ public class AlumnoService implements IAlumno{
if(secondaryOption.equalsIgnoreCase("Todo")){ if(secondaryOption.equalsIgnoreCase("Todo")){
return findAllPaginated(pageNum, size, sortField, sortDir); return findAllPaginated(pageNum, size, sortField, sortDir);
}else if (secondaryOption.equals("Apellido")) { }else if (secondaryOption.equals("Apellido")) {
return alumnoRepository.findAlumnoByApellido(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending())); return alumnoRepository.findAlumnoByApellidos(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending()));
} else if(secondaryOption.equals("Nombre")) { } else if(secondaryOption.equals("Nombre")) {
return alumnoRepository.findAlumnoByNombre(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending())); return alumnoRepository.findAlumnoByNombre(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending()));
}else if(secondaryOption.equals("Keywords")) { }else if(secondaryOption.equals("Keywords")) {
return alumnoRepository.findAlumnoByKeywords(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending())); return alumnoRepository.findAlumnoByKeywords(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending()));
}else if(secondaryOption.equals("Nia")) {
return alumnoRepository.findAlumnoByNia(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending()));
}else if(secondaryOption.equals("Dni")) {
return alumnoRepository.findAlumnoByDni(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending()));
}else if(secondaryOption.equals("Ciclo")) { }else if(secondaryOption.equals("Ciclo")) {
return alumnoRepository.findAlumnoByCiclo(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending())); return alumnoRepository.findAlumnoByCiclo(query, PageRequest.of(pageNum - 1, size, Sort.by(sortField).ascending()));
} else { } else {
@ -49,8 +45,6 @@ public class AlumnoService implements IAlumno{
return alumnoRepository.findAll(); return alumnoRepository.findAll();
} }
@Override @Override
public Alumno findById(Long id) { public Alumno findById(Long id) {
return alumnoRepository.findById(id).orElse(null); return alumnoRepository.findById(id).orElse(null);

@ -113,10 +113,14 @@ body {
white-space: normal; white-space: normal;
text-align: center; text-align: center;
} }
.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
}
i.fas.fa-arrow-left { i.fas.fa-arrow-left {
z-index: 1; z-index: 1;
pointer-events: auto; /* Add this line */ pointer-events: auto;
} }
.button-group { .button-group {
display: flex; display: flex;
@ -164,7 +168,6 @@ html, body {
#create-icon { #create-icon {
color: green; color: green;
font-size: 20px; font-size: 20px;
margin-left: 10px;
} }
.inactive { .inactive {
pointer-events: none; pointer-events: none;

@ -30,12 +30,16 @@
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="scrollable-table"> <div class="scrollable-table">
<table class="table" id="table"> <table class="table" id="table">

@ -24,13 +24,16 @@
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">
<thead class="thread-light"> <thead class="thread-light">

@ -24,12 +24,17 @@
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" ></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">
<thead class="thread-light"> <thead class="thread-light">

@ -27,12 +27,16 @@
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" ></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">

@ -22,13 +22,17 @@
<a href="/logout" class="logout-button"><i class="fas fa-door-open "></i></a> <a href="/logout" class="logout-button"><i class="fas fa-door-open "></i></a>
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">
<thead class="thread-light"> <thead class="thread-light">

@ -26,12 +26,16 @@
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" ></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="scrollable-table"> <div class="scrollable-table">
<table class="table" id="table"> <table class="table" id="table">

@ -24,12 +24,16 @@
</div> </div>
<div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por...."> <input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i> <i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group"> <div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button> <button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button> <button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div> </div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">

@ -15,10 +15,6 @@
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div>
<h1> <h1>
<i class="fas fa-arrow-left" onclick="goBack()" style="cursor:pointer;"></i> <i class="fas fa-arrow-left" onclick="goBack()" style="cursor:pointer;"></i>
Listado de Skills Listado de Skills
@ -27,7 +23,16 @@
</div> </div>
<input type="text" id="myInput" placeholder="Buscar por...."> <i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i> <div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">

@ -15,10 +15,6 @@
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div>
<h1> <h1>
<i class="fas fa-arrow-left" onclick="goBack()" style="cursor:pointer;"></i> <i class="fas fa-arrow-left" onclick="goBack()" style="cursor:pointer;"></i>
Listado de Ofertas Listado de Ofertas
@ -27,7 +23,16 @@
</div> </div>
<input type="text" id="myInput" placeholder="Buscar por...."> <i class="fas fa-plus hide-icon" id="create-icon"></i> <div class="toolbar">
<div>
<input type="text" id="myInput" placeholder="Buscar por....">
<i class="fas fa-plus hide-icon" id="create-icon" ></i>
</div>
<div class="button-group">
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
</div>
</div>
<div class="table-container"> <div class="table-container">
<table class="table" id="table"> <table class="table" id="table">

@ -75,7 +75,7 @@
<div class ="form-group row"> <div class ="form-group row">
<label class="col-sm-3 col-form-label" for="apellido2">Apellido2</label> <label class="col-sm-3 col-form-label" for="apellido2">Apellido2</label>
<div class = "col-sm-9"> <div class = "col-sm-9">
<input type="text" th:field="*{apellido2}" required minlength="1" maxlength="100" class="form-control" id="apellido2"> <input type="text" th:field="*{apellido2}" minlength="1" maxlength="100" class="form-control" id="apellido2">
</div> </div>
</div> </div>

Loading…
Cancel
Save

Powered by INFORMATICA.FP.EDU.ES.