Skip to content

Commit df7da5f

Browse files
authored
Merge pull request #1599 from zfi/0.101
Add code to trap new Cloud Session exception.
2 parents f2d0dfb + e90f873 commit df7da5f

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

src/main/java/com/parallax/server/blocklyprop/rest/RestProfile.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.parallax.client.cloudsession.exceptions.ServerException;
2121
import com.parallax.client.cloudsession.exceptions.UnknownUserIdException;
2222
import com.parallax.client.cloudsession.exceptions.WrongAuthenticationSourceException;
23+
import com.parallax.client.cloudsession.exceptions.EmailNotConfirmedException;
2324
import com.parallax.client.cloudsession.objects.User;
2425
import javax.ws.rs.FormParam;
2526
import javax.ws.rs.POST;
@@ -153,6 +154,10 @@ public Response savePassword(
153154
result.addProperty("success", false);
154155
result.addProperty("message", "server-error");
155156
return Response.ok(result.toString()).build();
157+
} catch (EmailNotConfirmedException pce) {
158+
result.addProperty("success", false);
159+
result.addProperty("message", "password-complexity");
160+
return Response.ok(result.toString()).build();
156161
}
157162
}
158163
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.parallax.client.cloudsession.exceptions.ServerException;
1515
import com.parallax.client.cloudsession.exceptions.UnknownUserException;
1616
import com.parallax.client.cloudsession.exceptions.WrongAuthenticationSourceException;
17+
import com.parallax.client.cloudsession.exceptions.EmailNotConfirmedException;
1718
import com.parallax.server.blocklyprop.enums.PasswordResetPage;
1819
import com.parallax.server.blocklyprop.utils.ServletUtils;
1920
import com.parallax.server.blocklyprop.utils.TextileReader;
@@ -98,6 +99,9 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
9899
LOG.warn("Trying to change password of non local user!");
99100
req.setAttribute("server-error", "Server exception");
100101
req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp);
102+
} catch (EmailNotConfirmedException pce) {
103+
req.setAttribute("passwordComplexity", "Password is not complex enough");
104+
req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp);
101105
}
102106
}
103107
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ private void savePassword(HttpServletRequest req, HttpServletResponse resp) thro
235235
LOG.warn("Trying to change password of non local user!");
236236
req.setAttribute("base-error", "Server error");
237237
req.getRequestDispatcher("WEB-INF/servlet/profile/profile.jsp").forward(req, resp);
238+
} catch (EmailNotConfirmedException ex) {
239+
LOG.warn("Trying to change password of non local user!");
240+
req.setAttribute("base-error", "Server error");
241+
req.getRequestDispatcher("WEB-INF/servlet/profile/profile.jsp").forward(req, resp);
238242
}
239243
}
240244
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.parallax.client.cloudsession.CloudSessionUserService;
1212
import com.parallax.client.cloudsession.exceptions.ServerException;
1313
import com.parallax.client.cloudsession.exceptions.UnknownUserIdException;
14+
import com.parallax.client.cloudsession.exceptions.EmailNotConfirmedException;
1415
import com.parallax.server.blocklyprop.db.generated.tables.pojos.User;
1516
import com.parallax.server.blocklyprop.services.UserService;
1617
import com.parallax.server.blocklyprop.services.impl.SecurityServiceImpl;
@@ -86,6 +87,9 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
8687
} catch (UnknownUserIdException ex) {
8788
LOG.info("User not known in cloud-session");
8889
resp.sendError(404);
90+
} catch (EmailNotConfirmedException ex) {
91+
LOG.info("User not known in cloud-session");
92+
resp.sendError(404);
8993
} catch (ServerException ex) {
9094
LOG.error("Communication problem with Cloud-session", ex);
9195
resp.sendError(500);

0 commit comments

Comments
 (0)