Fix lesson it no marks it as solved if the user uses a different username
This commit is contained in:
parent
f7d3fd586e
commit
59c96f9890
@ -48,14 +48,14 @@ public class SqlInjectionChallengeLogin extends AssignmentEndpoint {
|
||||
@ResponseBody
|
||||
public AttackResult login(@RequestParam String username_login, @RequestParam String password_login) throws Exception {
|
||||
try (var connection = dataSource.getConnection()) {
|
||||
PreparedStatement statement = connection.prepareStatement("select password from sql_challenge_users where userid = ? and password = ?");
|
||||
var statement = connection.prepareStatement("select password from sql_challenge_users where userid = ? and password = ?");
|
||||
statement.setString(1, username_login);
|
||||
statement.setString(2, password_login);
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
var resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
return ("tom".equals(username_login)) ? success(this).build()
|
||||
: success(this).feedback("ResultsButNotTom").build();
|
||||
: failed(this).feedback("ResultsButNotTom").build();
|
||||
} else {
|
||||
return failed(this).feedback("NoResultsMatched").build();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user