Skip to content

Commit 0ca3f09

Browse files
committed
Fixed #129, Fixed #126, working on 168
1 parent 88867d3 commit 0ca3f09

File tree

12 files changed

+274
-264
lines changed

12 files changed

+274
-264
lines changed

src/main/java/org/woehlke/simpleworklist/taskstate/TaskMoveServiceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.ArrayList;
1818
import java.util.Date;
1919
import java.util.List;
20+
import java.util.UUID;
2021

2122
@Slf4j
2223
@Service
@@ -106,6 +107,7 @@ public Task updatedViaProject(Task task) {
106107
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
107108
public Task addToProject(Task task) {
108109
log.info("addToProject");
110+
task.setUuid(UUID.randomUUID().toString());
109111
task = taskRepository.saveAndFlush(task);
110112
log.info("persisted: " + task.getId());
111113
return task;
@@ -115,6 +117,7 @@ public Task addToProject(Task task) {
115117
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
116118
public Task addToRootProject(Task task) {
117119
log.info("addToRootProject");
120+
task.setUuid(UUID.randomUUID().toString());
118121
task = taskRepository.saveAndFlush(task);
119122
log.info("persisted: " + task.getId());
120123
return task;
@@ -484,6 +487,7 @@ private void moveTasksDownByProject( Task sourceTask, Task destinationTask ) {
484487
@Override
485488
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
486489
public Task addToInbox(Task task) {
490+
task.setUuid(UUID.randomUUID().toString());
487491
task.setRootProject();
488492
if(task.getDueDate()==null){
489493
task.setTaskState(TaskState.INBOX);

src/main/java/org/woehlke/simpleworklist/user/register/UserRegistrationController.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public UserRegistrationController(UserAccountService userAccountService, UserReg
3636
* @return Formular for entering Email-Address for Registration
3737
*/
3838
@RequestMapping(path = "/register", method = RequestMethod.GET)
39-
public final String registerNewUserRequestForm(Model model) {
39+
public final String registerGet(Model model) {
40+
log.info("registerGet");
4041
UserRegistrationForm userRegistrationForm = new UserRegistrationForm();
4142
model.addAttribute("userRegistrationForm", userRegistrationForm);
4243
return "user/register/registerForm";
@@ -51,11 +52,12 @@ public final String registerNewUserRequestForm(Model model) {
5152
* @return info page at success or return to form with error messages.
5253
*/
5354
@RequestMapping(path = "/register", method = RequestMethod.POST)
54-
public final String registerNewUserRequestStoreAndSendEmailForVerification(
55+
public final String registerPost(
5556
@Valid UserRegistrationForm userRegistrationForm,
5657
BindingResult result,
5758
Model model
5859
) {
60+
log.info("registerPost");
5961
if (result.hasErrors()) {
6062
return "user/register/registerForm";
6163
} else {
@@ -91,10 +93,11 @@ public final String registerNewUserRequestStoreAndSendEmailForVerification(
9193
* @return Formular for Entering Account Task or Error Messages.
9294
*/
9395
@RequestMapping(path = "/register/confirm/{confirmId}", method = RequestMethod.GET)
94-
public final String registerNewUserCheckResponseAndRegistrationForm(
96+
public final String registerConfirmGet(
9597
@PathVariable String confirmId,
9698
Model model
9799
) {
100+
log.info("registerConfirmGet");
98101
log.info("GET /confirm/" + confirmId);
99102
UserRegistration o = userRegistrationService.findByToken(confirmId);
100103
if (o != null) {
@@ -118,12 +121,13 @@ public final String registerNewUserCheckResponseAndRegistrationForm(
118121
* @return login page at success or page with error messages.
119122
*/
120123
@RequestMapping(path = "/register/confirm/{confirmId}", method = RequestMethod.POST)
121-
public final String registerNewUserCheckResponseAndRegistrationStore(
124+
public final String registerConfirmPost(
122125
@PathVariable String confirmId,
123126
@Valid UserAccountForm userAccountForm,
124127
BindingResult result,
125128
Model model
126129
) {
130+
log.info("registerConfirmPost");
127131
log.info("POST /confirm/" + confirmId + " : " + userAccountForm.toString());
128132
userRegistrationService.registrationCheckIfResponseIsInTime(userAccountForm.getUserEmail());
129133
UserRegistration oUserRegistration = userRegistrationService.findByToken(confirmId);

src/main/java/org/woehlke/simpleworklist/user/register/UserRegistrationServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.woehlke.simpleworklist.user.register;
22

33
import java.util.Date;
4+
import java.util.UUID;
45

56
import lombok.extern.slf4j.Slf4j;
67
import org.springframework.beans.factory.annotation.Autowired;
@@ -59,6 +60,7 @@ public void registrationCheckIfResponseIsInTime(String email) {
5960
public void registrationSendEmailTo(String email) {
6061
UserRegistration earlierOptIn = userRegistrationRepository.findByEmail(email);
6162
UserRegistration o = new UserRegistration();
63+
o.setUuid(UUID.randomUUID().toString());
6264
if (earlierOptIn != null) {
6365
o = earlierOptIn;
6466
o.increaseNumberOfRetries();
@@ -110,7 +112,7 @@ private void sendEmailToRegisterNewUser(UserRegistration o) {
110112
msg.setText(
111113
"Dear new User, "
112114
+ "thank you for registring at Simple Worklist. \n"
113-
+ "Please validate your email and go to URL: \nhttp://" + urlHost + "/confirm/" + o.getToken()
115+
+ "Please validate your email and go to URL: \nhttp://" + urlHost + "/user/register/confirm/" + o.getToken()
114116
+ "\n\nSincerely Yours, The Team");
115117
msg.setSubject("Your Registration at Simple Worklist");
116118
msg.setFrom(mailFrom);

src/main/java/org/woehlke/simpleworklist/user/resetpassword/UserPasswordRecoveryController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@Slf4j
2222
@Controller
23-
@RequestMapping(path = "/user/resetPassword")
23+
@RequestMapping(path = "/user")
2424
public class UserPasswordRecoveryController {
2525

2626
private final UserAccountService userAccountService;
@@ -39,7 +39,7 @@ public UserPasswordRecoveryController(UserAccountService userAccountService, Use
3939
* @param model
4040
* @return a Formular for entering the email-adress.
4141
*/
42-
@RequestMapping(method = RequestMethod.GET)
42+
@RequestMapping(path="/resetPassword", method = RequestMethod.GET)
4343
public final String passwordForgottenForm(Model model) {
4444
UserRegistrationForm userRegistrationForm = new UserRegistrationForm();
4545
model.addAttribute("userRegistrationForm", userRegistrationForm);
@@ -54,7 +54,7 @@ public final String passwordForgottenForm(Model model) {
5454
* @param model
5555
* @return info page if without errors or formular again displaying error messages.
5656
*/
57-
@RequestMapping(method = RequestMethod.POST)
57+
@RequestMapping(path="/resetPassword", method = RequestMethod.POST)
5858
public final String passwordForgottenPost(
5959
@Valid UserRegistrationForm userRegistrationForm,
6060
BindingResult result,
@@ -92,7 +92,7 @@ public final String passwordForgottenPost(
9292
* @param model
9393
* @return a Formular for entering the new Password.
9494
*/
95-
@RequestMapping(path = "/confirm/{confirmId}", method = RequestMethod.GET)
95+
@RequestMapping(path = "/resetPassword/confirm/{confirmId}", method = RequestMethod.GET)
9696
public final String enterNewPasswordFormular(
9797
@PathVariable String confirmId,
9898
Model model
@@ -120,7 +120,7 @@ public final String enterNewPasswordFormular(
120120
* @param model
121121
* @return Info Page for success or back to formular with error messages.
122122
*/
123-
@RequestMapping(path = "/confirm/{confirmId}", method = RequestMethod.POST)
123+
@RequestMapping(path = "/resetPassword/confirm/{confirmId}", method = RequestMethod.POST)
124124
public final String enterNewPasswordPost(
125125
@Valid UserAccountForm userAccountForm,
126126
BindingResult result,

src/main/resources/application.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ org:
7575
- "/favicon.ico"
7676
- "/user/login*"
7777
- "/user/register*"
78-
- "/user/register/confirm/**"
78+
- "/user/register/**"
7979
- "/user/resetPassword*"
80-
- "/user/resetPassword/confirm/**"
80+
- "/user/resetPassword/**"
8181
- "/error*"
8282
strengthBCryptPasswordEncoder: 10
8383
---

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h1>
1818
</div>
1919

2020
<div th:fragment="mytwcontent">
21-
<form id="formId" th:action="@{/project/root/add/task}" th:object="${task}" method="post">
21+
<form id="formId" th:action="@{/taskstate/task/add}" th:object="${task}" method="post">
2222
<input type="hidden" th:field="*{taskState}" />
2323
<input type="hidden" th:field="*{context.id}" />
2424
<input type="hidden" th:field="*{rowCreatedAt.time}" />
Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
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 | ' + #{user.registerConfirmed.h1}">Title</title>
9-
</head>
10-
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{})">
11-
12-
<div th:fragment="mytwtitle">
13-
<h1>
14-
<span th:utext="#{user.registerConfirmed.h1}">Register as new User</span>
15-
</h1>
16-
</div>
17-
18-
<div th:fragment="mytwcontent">
19-
<div class="card card-body">
20-
<form id="formId" th:action="@{/confirm/{confirmId}(confirmId=${confirmId})}" th:object="${userAccountForm}" method="post">
21-
<input type="hidden" th:field="*{userEmail}" />
22-
<div class="form-group">
23-
<label th:for="${#ids.next('userFullname')}" class="control-label">
24-
<span th:utext="#{user.registerConfirmed.userFullname}">Full Name</span>
25-
</label>
26-
<input type="text" th:field="*{userFullname}" class="form-control" />
27-
<div>
28-
<div th:each="err : ${#fields.errors('userFullname')}" th:text="${err}" class="alert alert-danger" >
29-
</div>
30-
</div>
31-
</div>
32-
<div class="form-group">
33-
<label th:for="${#ids.next('userPassword')}" class="control-label">
34-
<span th:utext="#{user.registerConfirmed.userPassword}">Password</span>
35-
</label>
36-
<input type="password" th:field="*{userPassword}" class="form-control" />
37-
<div>
38-
<div th:each="err : ${#fields.errors('userPassword')}" th:text="${err}" class="alert alert-danger" >
39-
</div>
40-
</div>
41-
</div>
42-
<div class="form-group">
43-
<label th:for="${#ids.next('userPasswordConfirmation')}" class="control-label">
44-
<span th:utext="#{user.registerConfirmed.userPasswordConfirmation}">Password again</span>
45-
</label>
46-
<input type="password" th:field="*{userPasswordConfirmation}" class="form-control" />
47-
<div>
48-
<div th:each="err : ${#fields.errors('userPasswordConfirmation')}" th:text="${err}" class="alert alert-danger" >
49-
</div>
50-
</div>
51-
</div>
52-
<button id="confirmRegistration" type="submit" class="btn btn-primary">
53-
<span th:utext="#{user.registerConfirmed.button}">Confirm Registration</span>
54-
</button>
55-
</form>
56-
</div>
57-
</div>
58-
59-
60-
</body>
61-
</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 | ' + #{user.registerConfirmed.h1}">Title</title>
9+
</head>
10+
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{})">
11+
12+
<div th:fragment="mytwtitle">
13+
<h1>
14+
<span th:utext="#{user.registerConfirmed.h1}">Register as new User</span>
15+
</h1>
16+
</div>
17+
18+
<div th:fragment="mytwcontent">
19+
<div class="card card-body">
20+
<form id="formId" th:action="@{/user/register/confirm/{confirmId}(confirmId=${confirmId})}" th:object="${userAccountForm}" method="post">
21+
<input type="hidden" th:field="*{userEmail}" />
22+
<div class="form-group">
23+
<label th:for="${#ids.next('userFullname')}" class="control-label">
24+
<span th:utext="#{user.registerConfirmed.userFullname}">Full Name</span>
25+
</label>
26+
<input type="text" th:field="*{userFullname}" class="form-control" />
27+
<div>
28+
<div th:each="err : ${#fields.errors('userFullname')}" th:text="${err}" class="alert alert-danger" >
29+
</div>
30+
</div>
31+
</div>
32+
<div class="form-group">
33+
<label th:for="${#ids.next('userPassword')}" class="control-label">
34+
<span th:utext="#{user.registerConfirmed.userPassword}">Password</span>
35+
</label>
36+
<input type="password" th:field="*{userPassword}" class="form-control" />
37+
<div>
38+
<div th:each="err : ${#fields.errors('userPassword')}" th:text="${err}" class="alert alert-danger" >
39+
</div>
40+
</div>
41+
</div>
42+
<div class="form-group">
43+
<label th:for="${#ids.next('userPasswordConfirmation')}" class="control-label">
44+
<span th:utext="#{user.registerConfirmed.userPasswordConfirmation}">Password again</span>
45+
</label>
46+
<input type="password" th:field="*{userPasswordConfirmation}" class="form-control" />
47+
<div>
48+
<div th:each="err : ${#fields.errors('userPasswordConfirmation')}" th:text="${err}" class="alert alert-danger" >
49+
</div>
50+
</div>
51+
</div>
52+
<button id="confirmRegistration" type="submit" class="btn btn-primary">
53+
<span th:utext="#{user.registerConfirmed.button}">Confirm Registration</span>
54+
</button>
55+
</form>
56+
</div>
57+
</div>
58+
59+
60+
</body>
61+
</html>
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
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 | ' + #{user.registerDone.h1}">Title</title>
9-
</head>
10-
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{})">
11-
12-
<div th:fragment="mytwtitle">
13-
<h1>
14-
<span th:utext="#{user.registerDone.h1}">Register as new User</span>
15-
</h1>
16-
</div>
17-
18-
<div th:fragment="mytwcontent">
19-
<div class="card card-body">
20-
<p>
21-
<span th:utext="#{user.registerDone.text1}">You are registered now.</span>
22-
<a th:href="@{/login}">
23-
<span th:utext="#{user.registerDone.text2}">Please log in here</span>
24-
</a>
25-
</p>
26-
</div>
27-
</div>
28-
29-
30-
</body>
31-
</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 | ' + #{user.registerDone.h1}">Title</title>
9+
</head>
10+
<body th:replace="layout/page :: tw-page-body(twcontent=~{::mytwcontent},twtitle=~{::mytwtitle},scripts=~{})">
11+
12+
<div th:fragment="mytwtitle">
13+
<h1>
14+
<span th:utext="#{user.registerDone.h1}">Register as new User</span>
15+
</h1>
16+
</div>
17+
18+
<div th:fragment="mytwcontent">
19+
<div class="card card-body">
20+
<p>
21+
<span th:utext="#{user.registerDone.text1}">You are registered now.</span>
22+
<a th:href="@{/user/login}">
23+
<span th:utext="#{user.registerDone.text2}">Please log in here</span>
24+
</a>
25+
</p>
26+
</div>
27+
</div>
28+
29+
30+
</body>
31+
</html>

0 commit comments

Comments
 (0)