Skip to content

Commit 60988ee

Browse files
committed
Add copyright messsage and additional logging detail.
1 parent 19415c9 commit 60988ee

File tree

4 files changed

+100
-17
lines changed

4 files changed

+100
-17
lines changed

src/main/java/com/parallax/server/blocklyprop/servlets/ConfirmRequestServlet.java

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
2+
* Copyright (c) 2019 Parallax Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5+
* and associated documentation files (the “Software”), to deal in the Software without
6+
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
7+
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
8+
* Software is furnished to do so, subject to the following conditions:
9+
*
10+
* The above copyright notice and this permission notice shall be included in all copies or
11+
* substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
* SOFTWARE.
520
*/
21+
622
package com.parallax.server.blocklyprop.servlets;
723

824
import com.google.common.base.Strings;

src/main/java/com/parallax/server/blocklyprop/servlets/ConfirmServlet.java

+27-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
2+
* Copyright (c) 2019 Parallax Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5+
* and associated documentation files (the “Software”), to deal in the Software without
6+
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
7+
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
8+
* Software is furnished to do so, subject to the following conditions:
9+
*
10+
* The above copyright notice and this permission notice shall be included in all copies or
11+
* substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
* SOFTWARE.
520
*/
21+
622
package com.parallax.server.blocklyprop.servlets;
723

824
import com.google.common.base.Strings;
@@ -33,6 +49,9 @@
3349
@Singleton
3450
public class ConfirmServlet extends HttpServlet {
3551

52+
/**
53+
*
54+
*/
3655
private static Logger LOG = LoggerFactory.getLogger(ConfirmServlet.class);
3756

3857
private final TextileReader textileFileReader = new TextileReader();
@@ -76,21 +95,22 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
7695
public void confirmToken(HttpServletRequest req, HttpServletResponse resp)
7796
throws ServletException, IOException {
7897

79-
// Retreive the registration token
98+
// Retrieve the registration token
8099
String token = req.getParameter("token");
81100
req.setAttribute("token", token == null ? "" : token);
82101

83-
// Retreive the requestor's email address
102+
// Retrieve the requester's email address
84103
String email = req.getParameter("email");
85104
req.setAttribute("email", email == null ? "" : email);
86105

87106
// Return to the confirmation web page is we're missing data
88107
if (Strings.isNullOrEmpty(token) || Strings.isNullOrEmpty(email)) {
108+
LOG.info("Confirmation data for {} is incomplete. Reloading request page", email);
89109
req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp")
90110
.forward(req, resp);
91111
} else {
92112
try {
93-
LOG.info("Trying to confirm: {}, {}", email, token);
113+
LOG.info("Trying to confirm: {}", email);
94114
// Validate the email and token with the Cloud Session server
95115
if (cloudSessionLocalUserService.doConfirm(email, token)) {
96116

@@ -101,6 +121,7 @@ public void confirmToken(HttpServletRequest req, HttpServletResponse resp)
101121
// req.getRequestDispatcher("WEB-INF/servlet/confirm/confirmed.jsp").forward(req, resp);
102122
showTextilePage(req, resp, ConfirmPage.CONFIRMED);
103123
} else {
124+
LOG.info("Failed to verify the token for email address {}", email);
104125
req.setAttribute("invalidToken", "Invalid token");
105126
req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp").forward(req, resp);
106127
}

src/main/java/com/parallax/server/blocklyprop/servlets/PasswordResetRequestServlet.java

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
2+
* Copyright (c) 2019 Parallax Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5+
* and associated documentation files (the “Software”), to deal in the Software without
6+
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
7+
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
8+
* Software is furnished to do so, subject to the following conditions:
9+
*
10+
* The above copyright notice and this permission notice shall be included in all copies or
11+
* substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
* SOFTWARE.
520
*/
21+
622
package com.parallax.server.blocklyprop.servlets;
723

824
import com.google.common.base.Strings;

src/main/java/com/parallax/server/blocklyprop/servlets/PasswordResetServlet.java

+35-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
2+
* Copyright (c) 2019 Parallax Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5+
* and associated documentation files (the “Software”), to deal in the Software without
6+
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
7+
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
8+
* Software is furnished to do so, subject to the following conditions:
9+
*
10+
* The above copyright notice and this permission notice shall be included in all copies or
11+
* substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
* SOFTWARE.
520
*/
21+
622
package com.parallax.server.blocklyprop.servlets;
723

824
import com.google.common.base.Strings;
@@ -57,6 +73,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
5773
String email = req.getParameter("email");
5874
req.setAttribute("token", token == null ? "" : token);
5975
req.setAttribute("email", email == null ? "" : email);
76+
77+
LOG.info("Redirecting to the reset password page");
6078
req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp);
6179
}
6280

@@ -69,8 +87,12 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
6987
String email = req.getParameter("email");
7088
req.setAttribute("token", token == null ? "" : token);
7189
req.setAttribute("email", email == null ? "" : email);
90+
91+
7292
String password = req.getParameter("password");
7393
String confirmPassword = req.getParameter("confirmpassword");
94+
95+
LOG.info("Processing the results from the reset pasword page");
7496

7597
if (Strings.isNullOrEmpty(token) || Strings.isNullOrEmpty(email) || Strings.isNullOrEmpty(password) || Strings.isNullOrEmpty(confirmPassword)) {
7698
req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp);
@@ -107,8 +129,16 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
107129
}
108130
}
109131

110-
public void showTextilePage(HttpServletRequest req, HttpServletResponse resp, PasswordResetPage passwordResetPage) throws ServletException, IOException {
111-
String html = textileFileReader.readFile("password-reset/" + passwordResetPage.getPage(), ServletUtils.getLocale(req), req.isSecure());
132+
public void showTextilePage(
133+
HttpServletRequest req,
134+
HttpServletResponse resp,
135+
PasswordResetPage passwordResetPage) throws ServletException, IOException {
136+
137+
String html = textileFileReader.readFile(
138+
"password-reset/" + passwordResetPage.getPage(),
139+
ServletUtils.getLocale(req),
140+
req.isSecure());
141+
112142
req.setAttribute("html", html);
113143
req.getRequestDispatcher("/WEB-INF/servlet/html.jsp").forward(req, resp);
114144
}

0 commit comments

Comments
 (0)