modificamos el controladora para verificar si un usuario estaba registrado y confirmado

This commit is contained in:
2025-09-11 17:44:53 -04:00
parent ecdd4bec4d
commit 9a1fe7a378
3 changed files with 42 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package com.example.fercoganbackend.service;
import com.example.fercoganbackend.entity.Rol;
import com.example.fercoganbackend.entity.Usuario;
import com.example.fercoganbackend.otros.ConfirmadoTF;
import com.example.fercoganbackend.repository.UsuarioRepository;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
@@ -39,4 +40,16 @@ public class UsuarioService {
public boolean estaAprobado(String username) {
return repo.findByUsername(username).map(Usuario::isAprobado).orElse(false);
}
public boolean estaRegistrado(String username) {
return repo.findByUsername(username).isPresent();
}
public ConfirmadoTF registradoYAprobado(String username){
ConfirmadoTF confirmadotf = new ConfirmadoTF();
confirmadotf.setAuthenticated(estaRegistrado(username));
confirmadotf.setConfirmed(estaAprobado(username));
return confirmadotf;
}
}