Mot de passe oublie terminer

This commit is contained in:
jleroy
2024-04-29 13:44:37 +02:00
parent 2791df65ea
commit ae040010aa
18 changed files with 505 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package fr.eni.enchere.dal;
import fr.eni.enchere.bo.UserProfil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -60,6 +61,13 @@ public class UserRepositoryImpl implements UserRepository {
return user;
}
@Override
public UserProfil findUserByEmail(String email) {
String sql = "SELECT * FROM UTILISATEURS WHERE email = ? AND isDelete = 0";
UserProfil user = jdbcTemplate.queryForObject(sql, new UserRowMapper(), email);
return user;
}
@Override
public List<String> findAllUsernames() {
String sql = "SELECT pseudo FROM UTILISATEURS WHERE isDelete = 0";
@@ -74,6 +82,18 @@ public class UserRepositoryImpl implements UserRepository {
return email;
}
@Override
public String findByEmail(String email) {
//Vérifie si un email existe dans la base et est valide
String sql = "SELECT email FROM UTILISATEURS WHERE isDisabled = 0 AND email = ?";
try {
return jdbcTemplate.queryForObject(sql, new Object[]{email}, String.class);
} catch (EmptyResultDataAccessException e) {
// Aucun résultat trouvé, retourne null
return null;
}
}
@Override
public List<UserProfil> findAll() {
String sql = "SELECT * FROM UTILISATEURS WHERE isDelete = 0";