patch connexion

This commit is contained in:
Parpaillax
2024-04-23 17:00:07 +02:00
parent de2949417d
commit 03029c73f6
2 changed files with 5 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Repository;
@@ -57,16 +58,9 @@ public class UserRepositoryImpl implements UserRepository {
}
@Override
public UserProfil findByUsername(String username, String email) {
UserProfil user = null;
if (username != null) {
String sql = "SELECT * FROM UTILISATEURS WHERE pseudo = ? AND isDelete = 0";
user = jdbcTemplate.queryForObject(sql, new UserRowMapper(), username);
} else if (email != null) {
String sql = "SELECT * FROM UTILISATEURS WHERE email = ? AND isDelete = 0";
user = jdbcTemplate.queryForObject(sql, new UserRowMapper(), email);
}
System.out.println(user.getPassword());
public UserProfil findByUsername(String username) {
String sql = "SELECT * FROM UTILISATEURS WHERE pseudo = ? OR email = ? AND isDelete = 0";
UserProfil user = jdbcTemplate.queryForObject(sql, new UserRowMapper(), username, username);
return user;
}