+
Cookies
-
-
diff --git a/webgoat-container/src/main/webapp/css/main.css b/webgoat-container/src/main/webapp/css/main.css
index 1eb57dd5d..ee8e1c71a 100644
--- a/webgoat-container/src/main/webapp/css/main.css
+++ b/webgoat-container/src/main/webapp/css/main.css
@@ -738,7 +738,7 @@ cookie-container {
.cookie-table tr td, .params-table tr td {
padding: 3px;
- max-width: 200px;
+ max-width: 220px;
font-size: x-small;
word-wrap: break-word;
}
diff --git a/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js b/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js
index 959200343..5b9ce38fc 100644
--- a/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js
+++ b/webgoat-container/src/main/webapp/js/goatApp/controller/LessonController.js
@@ -8,6 +8,7 @@ define(['jquery',
'goatApp/view/SolutionView',
'goatApp/view/LessonHintView',
'goatApp/view/HelpControlsView',
+ 'goatApp/view/CookieView',
'goatApp/support/GoatUtils'
],
function($,
@@ -20,6 +21,7 @@ define(['jquery',
SolutionView,
LessonHintView,
HelpControlsView,
+ CookieView,
GoatUtils
) {
'use strict'
@@ -77,6 +79,7 @@ define(['jquery',
this.lessonHintView = new LessonHintView();
this.listenToOnce(this.lessonHintView,'hints:loaded',this.areHelpsReady);
//
+ this.cookieView = new CookieView();
this.hideShowHelps(null);
};
diff --git a/webgoat-container/src/main/webapp/js/goatApp/model/LessonCookieCollection.js b/webgoat-container/src/main/webapp/js/goatApp/model/LessonCookieCollection.js
new file mode 100644
index 000000000..9ab2d7aa7
--- /dev/null
+++ b/webgoat-container/src/main/webapp/js/goatApp/model/LessonCookieCollection.js
@@ -0,0 +1,13 @@
+define(['jquery',
+ 'underscore',
+ 'backbone',
+ 'goatApp/model/LessonCookieModel'],
+ function($,
+ _,
+ Backbone,
+ LessonCookieModel) {
+ return Backbone.Collection.extend({
+ url:'service/cookie.mvc',
+ model:LessonCookieModel
+ });
+});
\ No newline at end of file
diff --git a/webgoat-container/src/main/webapp/js/goatApp/model/LessonCookieModel.js b/webgoat-container/src/main/webapp/js/goatApp/model/LessonCookieModel.js
new file mode 100644
index 000000000..dcd5f2690
--- /dev/null
+++ b/webgoat-container/src/main/webapp/js/goatApp/model/LessonCookieModel.js
@@ -0,0 +1,9 @@
+define(['jquery',
+ 'underscore',
+ 'backbone'],
+ function($,
+ _,
+ Backbone) {
+ return Backbone.Model.extend({
+ });
+});
\ No newline at end of file
diff --git a/webgoat-container/src/main/webapp/js/goatApp/view/CookieView.js b/webgoat-container/src/main/webapp/js/goatApp/view/CookieView.js
new file mode 100644
index 000000000..f67cb190c
--- /dev/null
+++ b/webgoat-container/src/main/webapp/js/goatApp/view/CookieView.js
@@ -0,0 +1,33 @@
+define(['jquery',
+ 'underscore',
+ 'backbone',
+ 'goatApp/model/LessonCookieCollection'],
+function($,
+ _,
+ Backbone,
+ LessonCookieCollection) {
+ return Backbone.View.extend({
+ el:'#cookies-view',
+
+ initialize: function() {
+ this.collection = new LessonCookieCollection();
+ this.listenTo(this.collection,'reset',this.render)
+ this.collection.fetch({reset:true});
+ },
+
+ render: function() {
+ this.$el.html('')
+ var cookieTable;
+ this.collection.each(function(model) {
+ cookieTable = $('
',{'class':'cookie-table table-striped table-nonfluid'});
+ _.each(model.keys(), function(attribute) {
+ var newRow = $('');
+ newRow.append($('',{text:_.escape(attribute)}))
+ newRow.append($(' | ',{text:_.escape(model.get(attribute))}));
+ cookieTable.append(newRow);
+ });
+ });
+ this.$el.append(cookieTable);
+ }
+ });
+});
\ No newline at end of file
|