Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.owasp.webgoat.users.UserTrackerRepository;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;

Expand All @@ -58,4 +59,11 @@ public void restartLesson() {
flywayLessons.clean();
flywayLessons.migrate();
}

@PostMapping("/service/resetLessonDatabase.mvc")
@ResponseStatus(value = HttpStatus.OK)
public void resetLessonDatabase() {
flywayLessons.clean();
flywayLessons.migrate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sign.in=Sign in
register.new=Register new user
sign.up=Sign up
register.title=Register
database.reset=Reset lesson database


not.empty=This field is required.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ define(['jquery',
'lesson/:name': 'lessonRoute',
'lesson/:name/:pageNum': 'lessonPageRoute',
'test/:param': 'testRoute',
'reportCard': 'reportCard'
'reportCard': 'reportCard',
'resetLessonDatabase': 'resetLessonDatabase'
},

lessonController: null,
Expand Down Expand Up @@ -121,6 +122,13 @@ define(['jquery',
render(new ReportCardView());
});
},

resetLessonDatabase: function() {
$.ajax({
url:'service/resetLessonDatabase.mvc',
method:'POST'
});
},
});

return GoatAppRouter;
Expand Down
15 changes: 8 additions & 7 deletions webgoat-container/src/main/resources/templates/main_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,21 @@
<span th:text="${@environment.getProperty('webgoat.build.number')}"></span></a></li>
</ul>
</div>
<div style="display:inline" id="reset_db">
<a href="#resetLessonDatabase">
<button type="button" id="reset-db-button" class="btn btn-default right_nav_button button-up"
th:title="#{database.reset}">
<i class="fa fa-refresh"></i>
</button>
</a>
</div>
<div style="display:inline" id="settings">
<!--<button type="button" id="admin-button" class="btn btn-default right_nav_button" title="Administrator">-->
<!--<i class="fa fa-cog"></i>-->
<!--</button>-->
<a href="#reportCard">
<button type="button" id="report-card-button" class="btn btn-default right_nav_button button-up"
th:title="#{report.card}">
<i class="fa fa-bar-chart-o"></i>
</button>
</a>
<!--<button type="button" id="user-management" class="btn btn-default right_nav_button"-->
<!--title="User management">-->
<!--<i class="fa fa-users"></i>-->
<!--</button>-->
</div>
<button type="button" id="about-button" class="btn btn-default right_nav_button" th:title="#{about}"
data-toggle="modal" data-target="#about-modal">
Expand Down