|
|
@ -6,7 +6,10 @@ import com.cristobalbernal.foro.Entidades.UsersEntity; |
|
|
|
import com.cristobalbernal.foro.Respositorios.IUsers; |
|
|
|
import com.cristobalbernal.foro.Servicios.ServicioForo; |
|
|
|
import com.cristobalbernal.foro.Servicios.ServicioRespuestas; |
|
|
|
import com.cristobalbernal.foro.seguridad.models.UserDetailsImpl; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.security.core.context.SecurityContext; |
|
|
|
import org.springframework.security.core.context.SecurityContextHolder; |
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.ui.Model; |
|
|
@ -27,7 +30,10 @@ public class Controlador { |
|
|
|
private ServicioForo servicioForo; |
|
|
|
|
|
|
|
@GetMapping("/miperfil") |
|
|
|
public String miPerfil(){ |
|
|
|
public String miPerfil(Model model){ |
|
|
|
UserDetailsImpl userDetails = (UserDetailsImpl) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
|
|
|
UsersEntity users = iUsers.findByEmail(userDetails.getUsername()); |
|
|
|
model.addAttribute("nombre",users); |
|
|
|
return "miperfil/miperfil"; |
|
|
|
} |
|
|
|
@GetMapping({"","/home","/"}) |
|
|
@ -49,8 +55,9 @@ public class Controlador { |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/postdetall/{id}") |
|
|
|
public String postDetall(@PathVariable Long id,Model model){ |
|
|
|
public String postDetall(@PathVariable int id,Model model){ |
|
|
|
Foro foro = servicioForo.findById(id); |
|
|
|
List<RespuestasEntity> respuestas = servicioRespuestas.respuestasEntityList(id); |
|
|
|
model.addAttribute("Foro",foro); |
|
|
|
return "Respuestas/post-detall"; |
|
|
|
} |
|
|
|