Skip to content

Commit 8caa327

Browse files
committed
working on F008 Add first new Project: broken #103
1 parent e5330b6 commit 8caa327

File tree

6 files changed

+281
-257
lines changed

6 files changed

+281
-257
lines changed

src/main/java/org/woehlke/simpleworklist/config/di/WebSecurityConfig.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ protected void configure(HttpSecurity http) throws Exception {
7676
.logoutUrl(logoutUrl)
7777
.deleteCookies(cookieNamesToClear)
7878
.invalidateHttpSession(invalidateHttpSession)
79-
.permitAll();
79+
.permitAll()
80+
.and()
81+
.csrf()
82+
.and()
83+
.exceptionHandling()
84+
.accessDeniedPage("/error/error-403");
8085
}
8186

8287
private final static String loginProcessingUrl = "/j_spring_security_check";
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<h1>(403) Access Denied.</h1>
5+
<a href="/">Please Return to Startpage</a>
6+
</body>
7+
</html>
Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,70 @@
1-
<!DOCTYPE html>
2-
<html th:lang="${#locale.language}"
3-
xmlns="http://www.w3.org/1999/xhtml"
4-
xmlns:th="http://www.thymeleaf.org"
5-
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
6-
xmlns:sd="http://www.thymeleaf.org/spring-data">
7-
<head th:replace="layout/page :: tw-page-head(headtitle=~{::title},links=~{},refreshMessages=false)">
8-
<title th:text="'SimpleWorklist | ' + #{project.add.h1}">Title</title>
9-
</head>
10-
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{::script})">
11-
12-
<div th:fragment="mytwtitle">
13-
<!-- New Project Form -->
14-
<h1>
15-
<i class="fas fa-folder-open"></i> &nbsp;
16-
<span th:utext="#{project.add.h1}">Add Project</span>
17-
</h1>
18-
</div>
19-
20-
<div th:fragment="mytwcontent">
21-
<div>
22-
<form id="formId" th:action="@{/project/addchild/{id}(id=${thisProjectId})}" th:object="${project}" method="post">
23-
<div class="form-group">
24-
<label th:for="${#ids.next('name')}" class="control-label">Name</label>
25-
<input type="text" th:field="*{name}" class="form-control" />
26-
<div>
27-
<div th:each="err : ${#fields.errors('name')}" th:text="${err}" class="alert alert-danger"></div>
28-
</div>
29-
</div>
30-
<div class="form-group">
31-
<label th:for="textEditor" class="control-label">
32-
<span th:utext="#{project.add.description}">Description</span>
33-
</label>
34-
<textarea id="textEditor" name="textEditor" rows="10" cols="50" th:field="*{description}" class="form-control"></textarea>
35-
<div>
36-
<div th:each="err : ${#fields.errors('description')}" th:text="${err}" class="alert alert-danger"></div>
37-
</div>
38-
</div>
39-
<div class="form-group">
40-
<label th:for="${#ids.next('context.id')}" class="control-label">
41-
<span th:utext="#{project.edit.context}">Area</span>
42-
</label>
43-
<select th:field="*{context.id}">
44-
<option th:each="areaOption : ${contexts}"
45-
th:value="${areaOption.id}"
46-
th:text="${locale == 'de' ? areaOption.nameDe : areaOption.nameEn}">Wireframe</option>
47-
</select>
48-
<div>
49-
<div th:each="err : ${#fields.errors('context.id')}" th:text="${err}" class="alert alert-danger"></div>
50-
</div>
51-
</div>
52-
<button id="createNewProject" type="submit" class="btn btn-primary">
53-
<i class="fas fa-save"></i>
54-
<span th:utext="#{project.add.button}">Add Project</span>
55-
</button>
56-
</form>
57-
</div>
58-
<!-- Document Window End -->
59-
60-
</div>
61-
62-
<script th:src="@{/webjars/ckeditor/4.11.3/full/ckeditor.js}"></script>
63-
<script th:inline="javascript">
64-
CKEDITOR.replace( 'textEditor' );
65-
</script>
66-
</body>
67-
</html>
1+
<!DOCTYPE html>
2+
<html th:lang="${#locale.language}"
3+
xmlns="http://www.w3.org/1999/xhtml"
4+
xmlns:th="http://www.thymeleaf.org"
5+
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
6+
xmlns:sd="http://www.thymeleaf.org/spring-data">
7+
<head th:replace="layout/page :: tw-page-head(headtitle=~{::title},links=~{},refreshMessages=false)">
8+
<title th:text="'SimpleWorklist | ' + #{project.add.h1}">Title</title>
9+
</head>
10+
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{::script})">
11+
12+
<div th:fragment="mytwtitle">
13+
<!-- New Project Form -->
14+
<h1>
15+
<i class="fas fa-folder-open"></i> &nbsp;
16+
<span th:utext="#{project.add.h1}">Add Project</span>
17+
</h1>
18+
</div>
19+
20+
<div th:fragment="mytwcontent">
21+
<div>
22+
<form id="formId" th:action="@{/project/addchild/{id}(id=${thisProjectId})}" th:object="${project}" method="post">
23+
<div class="form-group">
24+
<label th:for="${#ids.next('name')}" class="control-label">Name</label>
25+
<input type="text" th:field="*{name}" class="form-control" />
26+
<div>
27+
<div th:each="err : ${#fields.errors('name')}" th:text="${err}" class="alert alert-danger"></div>
28+
</div>
29+
</div>
30+
<div class="form-group">
31+
<label th:for="textEditor" class="control-label">
32+
<span th:utext="#{project.add.description}">Description</span>
33+
</label>
34+
<textarea id="textEditor" name="textEditor" rows="10" cols="50" th:field="*{description}" class="form-control"></textarea>
35+
<div>
36+
<div th:each="err : ${#fields.errors('description')}" th:text="${err}" class="alert alert-danger"></div>
37+
</div>
38+
</div>
39+
<div class="form-group">
40+
<label th:for="${#ids.next('context.id')}" class="control-label">
41+
<span th:utext="#{project.edit.context}">Area</span>
42+
</label>
43+
<select th:field="*{context.id}">
44+
<option th:each="areaOption : ${contexts}"
45+
th:value="${areaOption.id}"
46+
th:text="${locale == 'de' ? areaOption.nameDe : areaOption.nameEn}">Wireframe</option>
47+
</select>
48+
<div>
49+
<div th:each="err : ${#fields.errors('context.id')}" th:text="${err}" class="alert alert-danger"></div>
50+
</div>
51+
</div>
52+
<input type="hidden"
53+
name="${_csrf.parameterName}"
54+
value="${_csrf.token}"/>
55+
<button id="createNewProject" type="submit" class="btn btn-primary">
56+
<i class="fas fa-save"></i>
57+
<span th:utext="#{project.add.button}">Add Project</span>
58+
</button>
59+
</form>
60+
</div>
61+
<!-- Document Window End -->
62+
63+
</div>
64+
65+
<script th:src="@{/webjars/ckeditor/4.11.3/full/ckeditor.js}"></script>
66+
<script th:inline="javascript">
67+
CKEDITOR.replace( 'textEditor' );
68+
</script>
69+
</body>
70+
</html>
Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,74 @@
1-
<!DOCTYPE html>
2-
<html th:lang="${#locale.language}"
3-
xmlns="http://www.w3.org/1999/xhtml"
4-
xmlns:th="http://www.thymeleaf.org"
5-
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
6-
xmlns:sd="http://www.thymeleaf.org/spring-data">
7-
<head th:replace="layout/page :: tw-page-head(headtitle=~{::title},links=~{},refreshMessages=false)">
8-
<title th:text="'SimpleWorklist | ' + #{project.edit.h1}">Title</title>
9-
</head>
10-
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{::script})">
11-
12-
<div th:fragment="mytwtitle">
13-
<!-- New Project Form -->
14-
<h1>
15-
<i class="fas fa-folder-open"></i>
16-
<span th:utext="#{project.edit.h1}">Edit Project</span>
17-
</h1>
18-
</div>
19-
20-
<div th:fragment="mytwcontent">
21-
<div>
22-
<form id="formId" th:action="@{/project/{id}/edit(id=${thisProject.id})}" th:object="${project}" method="post">
23-
<div class="form-group">
24-
<label th:for="${#ids.next('name')}" class="control-label">Name</label>
25-
<input type="text" th:field="*{name}" class="form-control" />
26-
<div>
27-
<div th:each="err : ${#fields.errors('name')}" th:text="${err}" class="alert alert-danger">
28-
</div>
29-
</div>
30-
</div>
31-
<div class="form-group">
32-
<label th:for="textEditor" class="control-label">
33-
<span th:utext="#{project.add.description}">Description</span>
34-
</label>
35-
<textarea id="textEditor" name="textEditor" rows="10" cols="50" th:field="*{description}" class="form-control"></textarea>
36-
<div>
37-
<div th:each="err : ${#fields.errors('description')}" th:text="${err}" class="alert alert-danger">
38-
</div>
39-
</div>
40-
</div>
41-
<div>
42-
<div class="form-group">
43-
<label th:for="${#ids.next('context.id')}" class="control-label">
44-
<span th:utext="#{project.edit.context}">Area</span>
45-
</label>
46-
<select th:field="*{context.id}">
47-
<option th:each="context : ${contexts}"
48-
th:value="${context.id}"
49-
th:text="${locale == 'de' ? context.nameDe : context.nameEn}">Wireframe</option>
50-
</select>
51-
<div>
52-
<div th:each="err : ${#fields.errors('context.id')}" th:text="${err}" class="alert alert-danger"></div>
53-
</div>
54-
</div>
55-
</div>
56-
<input type="hidden" th:field="*{id}" />
57-
<button id="saveEditedProject" type="submit" class="btn btn-primary">
58-
<i class="fas fa-save"></i>
59-
<span th:utext="#{project.edit.button}">Save Project</span>
60-
</button>
61-
</form>
62-
</div>
63-
<!-- Document Window End -->
64-
</div>
65-
66-
<script th:src="@{/webjars/ckeditor/4.11.3/full/ckeditor.js}"></script>
67-
<script th:inline="javascript">
68-
CKEDITOR.replace( 'textEditor' );
69-
</script>
70-
</body>
71-
</html>
1+
<!DOCTYPE html>
2+
<html th:lang="${#locale.language}"
3+
xmlns="http://www.w3.org/1999/xhtml"
4+
xmlns:th="http://www.thymeleaf.org"
5+
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
6+
xmlns:sd="http://www.thymeleaf.org/spring-data">
7+
<head th:replace="layout/page :: tw-page-head(headtitle=~{::title},links=~{},refreshMessages=false)">
8+
<title th:text="'SimpleWorklist | ' + #{project.edit.h1}">Title</title>
9+
</head>
10+
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{::script})">
11+
12+
<div th:fragment="mytwtitle">
13+
<!-- New Project Form -->
14+
<h1>
15+
<i class="fas fa-folder-open"></i>
16+
<span th:utext="#{project.edit.h1}">Edit Project</span>
17+
</h1>
18+
</div>
19+
20+
<div th:fragment="mytwcontent">
21+
<div>
22+
<form id="formId" th:action="@{/project/{id}/edit(id=${thisProject.id})}" th:object="${project}" method="post">
23+
<div class="form-group">
24+
<label th:for="${#ids.next('name')}" class="control-label">Name</label>
25+
<input type="text" th:field="*{name}" class="form-control" />
26+
<div>
27+
<div th:each="err : ${#fields.errors('name')}" th:text="${err}" class="alert alert-danger">
28+
</div>
29+
</div>
30+
</div>
31+
<div class="form-group">
32+
<label th:for="textEditor" class="control-label">
33+
<span th:utext="#{project.add.description}">Description</span>
34+
</label>
35+
<textarea id="textEditor" name="textEditor" rows="10" cols="50" th:field="*{description}" class="form-control"></textarea>
36+
<div>
37+
<div th:each="err : ${#fields.errors('description')}" th:text="${err}" class="alert alert-danger">
38+
</div>
39+
</div>
40+
</div>
41+
<div>
42+
<div class="form-group">
43+
<label th:for="${#ids.next('context.id')}" class="control-label">
44+
<span th:utext="#{project.edit.context}">Area</span>
45+
</label>
46+
<select th:field="*{context.id}">
47+
<option th:each="context : ${contexts}"
48+
th:value="${context.id}"
49+
th:text="${locale == 'de' ? context.nameDe : context.nameEn}">Wireframe</option>
50+
</select>
51+
<div>
52+
<div th:each="err : ${#fields.errors('context.id')}" th:text="${err}" class="alert alert-danger"></div>
53+
</div>
54+
</div>
55+
</div>
56+
<input type="hidden"
57+
name="${_csrf.parameterName}"
58+
value="${_csrf.token}"/>
59+
<input type="hidden" th:field="*{id}" />
60+
<button id="saveEditedProject" type="submit" class="btn btn-primary">
61+
<i class="fas fa-save"></i>
62+
<span th:utext="#{project.edit.button}">Save Project</span>
63+
</button>
64+
</form>
65+
</div>
66+
<!-- Document Window End -->
67+
</div>
68+
69+
<script th:src="@{/webjars/ckeditor/4.11.3/full/ckeditor.js}"></script>
70+
<script th:inline="javascript">
71+
CKEDITOR.replace( 'textEditor' );
72+
</script>
73+
</body>
74+
</html>

src/main/resources/templates/task/add.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ <h1>
9696
</div>
9797
</span>
9898
</div>
99+
<input type="hidden"
100+
name="${_csrf.parameterName}"
101+
value="${_csrf.token}"/>
99102
<button id="createNewTask" type="submit" class="btn btn-primary">
100103
<i class="fas fa-save"></i>
101104
<span th:utext="#{task.add.button}">Add Task</span>

0 commit comments

Comments
 (0)