1.1 --- a/freemarkerdor/pom.xml Sun Sep 13 16:48:54 2009 +0200
1.2 +++ b/freemarkerdor/pom.xml Sun Sep 13 20:07:32 2009 +0200
1.3 @@ -100,7 +100,7 @@
1.4 </plugin>
1.5 </plugins>
1.6 </build>
1.7 - <version>1.5</version>
1.8 + <version>1.6</version>
1.9 </project>
1.10
1.11
2.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sun Sep 13 16:48:54 2009 +0200
2.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sun Sep 13 20:07:32 2009 +0200
2.3 @@ -75,10 +75,14 @@
2.4
2.5 private Viewable checkLogin() {
2.6 if (headers.getCookies().containsKey("login")) {
2.7 - uuid = headers.getCookies().get("login").getValue();
2.8 - user = base.path("login").queryParam("id", uuid).
2.9 + String id = headers.getCookies().get("login").getValue();
2.10 + String us = base.path("login").queryParam("id", id).
2.11 accept(MediaType.TEXT_PLAIN).get(String.class);
2.12 - return null;
2.13 + if (us.length() > 0) {
2.14 + user = us;
2.15 + uuid = id;
2.16 + return null;
2.17 + }
2.18 }
2.19 return viewable("login.fmt", null);
2.20 }
3.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java Sun Sep 13 16:48:54 2009 +0200
3.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java Sun Sep 13 20:07:32 2009 +0200
3.3 @@ -105,7 +105,11 @@
3.4 public String isLoggedIn(
3.5 @QueryParam("id") String id
3.6 ) {
3.7 - return id == null ? null : loggedIn.get(UUID.fromString(id));
3.8 + try {
3.9 + return id == null ? "" : loggedIn.get(UUID.fromString(id));
3.10 + } catch (IllegalArgumentException ex) {
3.11 + return "";
3.12 + }
3.13 }
3.14
3.15 //
4.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/FinishedGameTest.java Sun Sep 13 16:48:54 2009 +0200
4.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/FinishedGameTest.java Sun Sep 13 20:07:32 2009 +0200
4.3 @@ -76,6 +76,13 @@
4.4 }
4.5 dir.delete();
4.6 }
4.7 + @Test public void testNotLoggedIn() {
4.8 + webResource = webResource.path("api");
4.9 + String status = webResource.path("login").queryParam("id", "not-logged-in").
4.10 + accept(MediaType.TEXT_PLAIN).get(String.class);
4.11 + assertEquals("Nobody is logged in", "", status);
4.12 + }
4.13 +
4.14
4.15 @Test public void testCreateAGame() throws Exception {
4.16 webResource = webResource.path("api");