diff --git a/WebContent/cardcast/index.html b/WebContent/cardcast/index.html
index abe320c..9cf3c8d 100644
--- a/WebContent/cardcast/index.html
+++ b/WebContent/cardcast/index.html
@@ -1,5 +1,5 @@
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/gianlu/pyxreloaded/Consts.java b/src/main/java/com/gianlu/pyxreloaded/Consts.java
index 6bc1c70..5668343 100644
--- a/src/main/java/com/gianlu/pyxreloaded/Consts.java
+++ b/src/main/java/com/gianlu/pyxreloaded/Consts.java
@@ -565,7 +565,11 @@ public enum Operation {
/**
* Create an user account.
*/
- CREATE_ACCOUNT("ca");
+ CREATE_ACCOUNT("ca"),
+ /**
+ * Retrieves user info.
+ */
+ GET_USER_INFO("gui");
private final String op;
diff --git a/src/main/java/com/gianlu/pyxreloaded/Server.java b/src/main/java/com/gianlu/pyxreloaded/Server.java
index 837a062..ec2a6ea 100644
--- a/src/main/java/com/gianlu/pyxreloaded/Server.java
+++ b/src/main/java/com/gianlu/pyxreloaded/Server.java
@@ -100,6 +100,10 @@ public static void main(String[] args) throws IOException, SQLException, Unrecov
RoutingHandler router = new RoutingHandler();
router.setFallbackHandler(pathHandler)
+ .get("/user/{nickname}/", exchange -> {
+ exchange.setRelativePath("/user.html");
+ resourceHandler.handleRequest(exchange);
+ })
.get("/game/{gid}/", exchange -> {
exchange.setRelativePath("/game.html");
resourceHandler.handleRequest(exchange);
diff --git a/src/main/java/com/gianlu/pyxreloaded/handlers/GetUserInfoHandler.java b/src/main/java/com/gianlu/pyxreloaded/handlers/GetUserInfoHandler.java
new file mode 100644
index 0000000..9473bfb
--- /dev/null
+++ b/src/main/java/com/gianlu/pyxreloaded/handlers/GetUserInfoHandler.java
@@ -0,0 +1,29 @@
+package com.gianlu.pyxreloaded.handlers;
+
+import com.gianlu.pyxreloaded.Consts;
+import com.gianlu.pyxreloaded.data.JsonWrapper;
+import com.gianlu.pyxreloaded.data.User;
+import com.gianlu.pyxreloaded.server.Annotations;
+import com.gianlu.pyxreloaded.server.BaseCahHandler;
+import com.gianlu.pyxreloaded.server.BaseJsonHandler;
+import com.gianlu.pyxreloaded.server.Parameters;
+import com.gianlu.pyxreloaded.singletons.UsersWithAccount;
+import io.undertow.server.HttpServerExchange;
+
+public class GetUserInfoHandler extends BaseHandler {
+ public static final String OP = Consts.Operation.GET_USER_INFO.toString();
+ private final UsersWithAccount accounts;
+
+ public GetUserInfoHandler(@Annotations.UsersWithAccount UsersWithAccount accounts) {
+ this.accounts = accounts;
+ }
+
+ @Override
+ public JsonWrapper handle(User requester, Parameters params, HttpServerExchange exchange) throws BaseJsonHandler.StatusException {
+ String nickname = params.getStringNotNull(Consts.GeneralKeys.NICKNAME);
+
+ if (!accounts.hasNickname(nickname)) throw new BaseCahHandler.CahException(Consts.ErrorCode.NO_SUCH_USER);
+
+ return new JsonWrapper(Consts.GeneralKeys.NICKNAME, nickname);
+ }
+}
diff --git a/src/main/java/com/gianlu/pyxreloaded/handlers/Handlers.java b/src/main/java/com/gianlu/pyxreloaded/handlers/Handlers.java
index 37160af..7da51e1 100644
--- a/src/main/java/com/gianlu/pyxreloaded/handlers/Handlers.java
+++ b/src/main/java/com/gianlu/pyxreloaded/handlers/Handlers.java
@@ -41,6 +41,7 @@ public class Handlers {
LIST.put(GameOptionsSuggestionDecisionHandler.OP, GameOptionsSuggestionDecisionHandler.class);
LIST.put(GetSuggestedGameOptionsHandler.OP, GetSuggestedGameOptionsHandler.class);
LIST.put(CreateAccountHandler.OP, CreateAccountHandler.class);
+ LIST.put(GetUserInfoHandler.OP, GetUserInfoHandler.class);
SKIP_USER_CHECK = new ArrayList<>();
SKIP_USER_CHECK.add(RegisterHandler.OP);