Mot de passe oublie terminer
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user