patch connexion
This commit is contained in:
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
public interface UserRepository {
|
||||
List<UserProfil> findAll();
|
||||
UserProfil findById(int id);
|
||||
UserProfil findByUsername(String username, String email);
|
||||
UserProfil findByUsername(String username);
|
||||
void save(UserProfil utilisateur);
|
||||
void delete(int id);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user