Remove as it matches the normal success message

This commit is contained in:
Nanne Baars 2021-03-29 11:00:48 +02:00 committed by Nanne Baars
parent 59aaab52a9
commit 798afc756b
6 changed files with 10 additions and 16 deletions

View File

@ -75,7 +75,7 @@ public class SqlInjectionLesson10 extends AssignmentEndpoint {
} }
} catch (SQLException e) { } catch (SQLException e) {
if (tableExists(connection)) { if (tableExists(connection)) {
return failed(this).feedback("sql-injection.error").output("<span class='feedback-negative'>" + e.getMessage() + "</span><br>" + output.toString()).build(); return failed(this).output("<span class='feedback-negative'>" + e.getMessage() + "</span><br>" + output.toString()).build();
} else { } else {
return success(this).feedback("sql-injection.10.success").build(); return success(this).feedback("sql-injection.10.success").build();
} }

View File

@ -87,14 +87,14 @@ public class SqlInjectionLesson8 extends AssignmentEndpoint {
return failed(this).feedback("sql-injection.8.no.results").build(); return failed(this).feedback("sql-injection.8.no.results").build();
} }
} else { } else {
return failed(this).feedback("sql-injection.error").build(); return failed(this).build();
} }
} catch (SQLException e) { } catch (SQLException e) {
return failed(this).feedback("sql-injection.error").output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build(); return failed(this).output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build();
} }
} catch (Exception e) { } catch (Exception e) {
return failed(this).feedback("sql-injection.error").output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build(); return failed(this).output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build();
} }
} }

View File

@ -75,14 +75,14 @@ public class SqlInjectionLesson9 extends AssignmentEndpoint {
} }
} catch (SQLException e) { } catch (SQLException e) {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
return failed(this).feedback("sql-injection.error").output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build(); return failed(this).output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build();
} }
return checkSalaryRanking(connection, output); return checkSalaryRanking(connection, output);
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
return failed(this).feedback("sql-injection.error").output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build(); return failed(this).output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build();
} }
} }
@ -103,7 +103,7 @@ public class SqlInjectionLesson9 extends AssignmentEndpoint {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
return failed(this).feedback("sql-injection.error").output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build(); return failed(this).output("<br><span class='feedback-negative'>" + e.getMessage() + "</span>").build();
} }
} }

View File

@ -7,9 +7,8 @@
SqlInjectionChallenge1=Look at the different response you receive from the server SqlInjectionChallenge1=Look at the different response you receive from the server
SqlInjectionChallenge2=The vulnerability is on the register form SqlInjectionChallenge2=The vulnerability is on the register form
SqlInjectionChallenge3=Use tooling to automate this attack SqlInjectionChallenge3=Use tooling to automate this attack
sql-injection.error=<span class='feedback-negative'>Sorry, this solution is not correct. Try again!</span> NoResultsMatched=No results matched, try again.
NoResultsMatched=<span class='feedback-negative'>No results matched. Try Again.</span> ResultsButNotTom=Try To login as Tom!
ResultsButNotTom=<span class='feedback-negative'>Try To login as Tom!</span>
sql-injection.2.success=<span class='feedback-positive'>You have succeeded!</span> sql-injection.2.success=<span class='feedback-positive'>You have succeeded!</span>
sql-injection.2.failed=<span class='feedback-negative'>Something went wrong! You got no results, check your SQL Statement and the table above.</span> sql-injection.2.failed=<span class='feedback-negative'>Something went wrong! You got no results, check your SQL Statement and the table above.</span>

View File

@ -96,11 +96,6 @@ public class SqlInjectionLesson8Test extends SqlLessonTest {
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("lessonCompleted", is(false))) .andExpect(jsonPath("lessonCompleted", is(false)))
.andExpect(jsonPath("$.feedback", is(modifySpan(messages.getMessage("sql-injection.error")))))
.andExpect(jsonPath("$.output", containsString("feedback-negative"))); .andExpect(jsonPath("$.output", containsString("feedback-negative")));
} }
public static String modifySpan(String message) {
return message.replace("</span>", "<\\/span>");
}
} }

View File

@ -151,7 +151,7 @@ public class SqlInjectionLesson9Test extends SqlLessonTest {
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("lessonCompleted", is(false))) .andExpect(jsonPath("lessonCompleted", is(false)))
.andExpect(jsonPath("$.feedback", is(SqlInjectionLesson8Test.modifySpan(messages.getMessage("sql-injection.error"))))) .andExpect(jsonPath("$.feedback", is(messages.getMessage("sql-injection.error"))))
.andExpect(jsonPath("$.output", containsString("feedback-negative"))); .andExpect(jsonPath("$.output", containsString("feedback-negative")));
} catch (AssertionError e) { } catch (AssertionError e) {
if (!e.getMessage().contains(completedError)) throw e; if (!e.getMessage().contains(completedError)) throw e;