diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/lessons/model/LessonInfoModel.java b/webgoat-container/src/main/java/org/owasp/webgoat/lessons/model/LessonInfoModel.java index ccafa2cea..e76d3e141 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/lessons/model/LessonInfoModel.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/lessons/model/LessonInfoModel.java @@ -1,6 +1,7 @@ package org.owasp.webgoat.lessons.model; import org.owasp.webgoat.lessons.AbstractLesson; +import org.owasp.webgoat.lessons.Category; import org.owasp.webgoat.session.WebSession; /** @@ -20,20 +21,15 @@ public class LessonInfoModel { public LessonInfoModel(WebSession webSession) { AbstractLesson lesson = webSession.getCurrentLesson(); //TODO make these first class citizens of the lesson itself; and stop passing the session all over -// this.source = (lesson.getSource(webSession)); -// this.plan = (lesson.getPage(webSession)); -// this.solution = (lesson.getSolution(webSession)); - this.hasSource = !lesson.getSource(webSession).contains("Could not find the source file or source file does not exist"); this.hasPlan = !lesson.getSource(webSession).contains("Could not find lesson plan"); this.hasSolution = !lesson.getSolution(webSession).contains("Could not find the solution file or solution file does not exist"); this.lessonTitle = lesson.getTitle(); + this.numberHints = lesson.getHintCount(webSession); - - if (this.numberHints == 1 && lesson.getHint(webSession,0).equals("Hint: There are no hints defined.")){ + if (lesson.getCategory().equals(Category.CHALLENGE) || this.numberHints < 1 || lesson.getHint(webSession,0).equals("Hint: There are no hints defined.")) { this.numberHints = 0; } - System.out.println("*** numHints = " + this.numberHints); } // GETTERS diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/service/HintService.java b/webgoat-container/src/main/java/org/owasp/webgoat/service/HintService.java index 76793ad65..20cd36691 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/service/HintService.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/service/HintService.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpSession; import org.owasp.webgoat.lessons.AbstractLesson; +import org.owasp.webgoat.lessons.Category; import org.owasp.webgoat.lessons.model.Hint; import org.owasp.webgoat.session.WebSession; import org.springframework.stereotype.Controller; @@ -40,11 +41,12 @@ public class HintService extends BaseService { if (l == null) { return listHints; } - List hints; - hints = l.getHintsPublic(ws); + List hints = (l.getCategory().equals(Category.CHALLENGE)) ? null : l.getHintsPublic(ws); + if (hints == null) { return listHints; } + int idx = 0; for (String h : hints) { Hint hint = new Hint();