diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/lessons/AttackResult.java b/webgoat-container/src/main/java/org/owasp/webgoat/lessons/AttackResult.java index dcd2204b5..ca4219849 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/lessons/AttackResult.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/lessons/AttackResult.java @@ -34,7 +34,7 @@ import lombok.Getter; @Getter public class AttackResult { - private boolean lessonCompleted; + private boolean assignmentCompleted; private String feedback; private String output; @@ -48,7 +48,7 @@ public class AttackResult { public static AttackResult success(String feedback, String output) { AttackResult attackResult = new AttackResult(); - attackResult.lessonCompleted = true; + attackResult.assignmentCompleted = true; attackResult.feedback = feedback; attackResult.output = output; return attackResult; @@ -60,13 +60,13 @@ public class AttackResult { public static AttackResult failed(String feedback, String output) { AttackResult attackResult = new AttackResult(); - attackResult.lessonCompleted = false; + attackResult.assignmentCompleted = false; attackResult.feedback = feedback; attackResult.output = output; return attackResult; } public boolean assignmentSolved() { - return lessonCompleted; + return assignmentCompleted; } } diff --git a/webgoat-container/src/main/resources/static/js/goatApp/controller/LessonController.js b/webgoat-container/src/main/resources/static/js/goatApp/controller/LessonController.js index 6ce9932b1..a4b93ff18 100644 --- a/webgoat-container/src/main/resources/static/js/goatApp/controller/LessonController.js +++ b/webgoat-container/src/main/resources/static/js/goatApp/controller/LessonController.js @@ -64,8 +64,8 @@ define(['jquery', this.listenTo(this.lessonContent,'content:loaded',this.onContentLoaded); this.userAndInfoView = new UserAndInfoView(); this.menuButtonView = new MenuButtonView(); - this.listenTo(this.lessonContentView, 'lesson:complete', this.updateMenu); - this.listenTo(this.lessonContentView, 'lesson:complete', this.updateLessonOverview); + this.listenTo(this.lessonContentView, 'assignment:complete', this.updateMenu); + this.listenTo(this.lessonContentView, 'assignment:complete', this.updateLessonOverview); }; this.loadLesson = function(name,pageNum) { diff --git a/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js b/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js index 7f0ce6794..1c51bcfd1 100644 --- a/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js +++ b/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js @@ -114,13 +114,24 @@ define(['jquery', this.renderFeedback(data.feedback); this.renderOutput(data.output || ""); - if (data.lessonCompleted) { - this.curForm.reset(); - this.trigger('lesson:complete'); + if (data.assignmentCompleted) { + this.markAssignmentComplete(); + this.trigger('assignment:complete'); + } else { + this.markAssignmentIncomplete(); } return false; }, + markAssignmentComplete: function () { + this.curForm.reset(); + $(this.curForm).siblings('.assignment-success').find('i').removeClass('hidden'); + }, + + markAssignmentIncomplete: function () { + $(this.curForm).siblings('.assignment-success').find('i').addClass('hidden'); + }, + onErrorResponse: function (a,b,c) { console.error(a); console.error(b); diff --git a/webgoat-container/src/main/resources/static/js/goatApp/view/LessonProgressView.js b/webgoat-container/src/main/resources/static/js/goatApp/view/LessonProgressView.js index 0c3e892b1..a3b05729d 100644 --- a/webgoat-container/src/main/resources/static/js/goatApp/view/LessonProgressView.js +++ b/webgoat-container/src/main/resources/static/js/goatApp/view/LessonProgressView.js @@ -16,7 +16,7 @@ define(['jquery', } }, render: function () { - if (this.model.get("lessonCompleted")) { + if (this.model.get("assignmentCompleted")) { this.$el.html(this.model.get('successMessage')); } else { this.$el.html(""); diff --git a/webgoat-lessons/cross-site-scripting/src/main/resources/plugin/CrossSiteScripting/html/CrossSiteScripting.html b/webgoat-lessons/cross-site-scripting/src/main/resources/plugin/CrossSiteScripting/html/CrossSiteScripting.html index 1e1001411..4872350dc 100644 --- a/webgoat-lessons/cross-site-scripting/src/main/resources/plugin/CrossSiteScripting/html/CrossSiteScripting.html +++ b/webgoat-lessons/cross-site-scripting/src/main/resources/plugin/CrossSiteScripting/html/CrossSiteScripting.html @@ -174,8 +174,8 @@ which you put in src/main/resources/plugin/lessonplans/{lang}/{fileName}.adoc -->