Skip to content

Commit

Permalink
render lesson content using jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
lawson89 committed Aug 18, 2014
1 parent 30f3c3a commit f3092a2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 24 deletions.
2 changes: 2 additions & 0 deletions java/org/owasp/webgoat/session/Screen.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public void output(PrintWriter out) {
// TODO we could hook all forms here with javascript call to ajax forms plugin
public String getContent() {
String makeFormsAjax = "<script> $(document).ready(function() { makeFormsAjax(); });</script>";
// handle this on the page with js
makeFormsAjax = "";
return (content == null) ? "" : content.toString() + makeFormsAjax;
}

Expand Down
2 changes: 1 addition & 1 deletion java/org/owasp/webgoat/session/WebSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public class WebSession {
/**
* Description of the Field
*/
public final static String SESSION = "Session";
public final static String SESSION = "websession";

public final static String SHOWSOURCE = "ShowSource";

Expand Down
10 changes: 6 additions & 4 deletions webapp/WEB-INF/pages/main_new.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
errorPage=""%>
<%@page import="org.owasp.webgoat.session.WebSession"%>
<%
WebSession webSession = ((WebSession) session.getAttribute("websession"));
WebSession webSession = ((WebSession) session.getAttribute(WebSession.SESSION));
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -84,9 +84,9 @@
<section id="main-content">
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-body" id="lesson_content">

<div class="panel" >
<div class="panel-body" id="lesson_content" ng-controller="goatMenu">
<p ng-model="lessonUrl"> {{lessonUrl}}</p>
<h1>About WebGoat</h1>
<hr />
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque volutpat feugiat nunc, non vulputate urna dictum ut. Nam consectetur porttitor diam ut ultricies. Aenean dolor dolor, congue sed ornare non, elementum in mauris. Phasellus orci sem, rhoncus eu laoreet eu, aliquam nec ante. Suspendisse sit amet justo eget eros tempor tincidunt vel quis justo. Sed pulvinar enim id neque pellentesque, eu rhoncus lorem eleifend. Morbi congue tortor sit amet pulvinar posuere.</p>
Expand Down Expand Up @@ -184,8 +184,10 @@
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
'\n\nThe output div should have already been updated with the responseText.');
}
makeFormsAjax();
}
function makeFormsAjax() {
//console.log("Hooking any lesson forms to make them ajax");
$("form").ajaxForm(options);
}
</script>
Expand Down
49 changes: 31 additions & 18 deletions webapp/js/goat.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/lessons/GoatHillsFinancial/error.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import="org.owasp.webgoat.session.*, org.owasp.webgoat.lessons.GoatHillsFinancial.GoatHillsFinancial"
errorPage="" %>
<%
WebSession webSession = ((WebSession)session.getAttribute("websession"));
WebSession webSession = ((WebSession)session.getAttribute(WebSession.SESSION));
// int myUserId = getIntSessionAttribute(webSession, "GoatHillsFinancial." + GoatHillsFinancial.USER_ID);
%>
<br><br><br>An error has occurred.
Expand Down

0 comments on commit f3092a2

Please sign in to comment.