diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-06 22:23:26 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-06 22:23:26 +1200 |
commit | 80e166430b79df771abc73e55892dc9f5fd0b2f1 (patch) | |
tree | 72c8849812ec43bd97f6f8bf65d6e700d5bdf7df /src/org/traccar/http | |
parent | b9d6befdbcc1a56c87d14066d67da574762d81bc (diff) | |
download | trackermap-server-80e166430b79df771abc73e55892dc9f5fd0b2f1.tar.gz trackermap-server-80e166430b79df771abc73e55892dc9f5fd0b2f1.tar.bz2 trackermap-server-80e166430b79df771abc73e55892dc9f5fd0b2f1.zip |
Add new user registration
Diffstat (limited to 'src/org/traccar/http')
-rw-r--r-- | src/org/traccar/http/MainServlet.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/http/MainServlet.java b/src/org/traccar/http/MainServlet.java index 8fa0a13af..036c472f8 100644 --- a/src/org/traccar/http/MainServlet.java +++ b/src/org/traccar/http/MainServlet.java @@ -20,6 +20,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.traccar.Context; +import org.traccar.model.User; public class MainServlet extends BaseServlet { @@ -31,6 +32,8 @@ public class MainServlet extends BaseServlet { login(req, resp); } else if (command.equals("/logout")) { logout(req, resp); + } else if (command.equals("/register")) { + register(req, resp); } else { return false; } @@ -52,4 +55,10 @@ public class MainServlet extends BaseServlet { sendResponse(resp.getWriter()); } + private void register(HttpServletRequest req, HttpServletResponse resp) throws Exception { + User user = JsonConverter.objectFromJson(req.getReader(), new User()); + Context.getDataManager().addUser(user); + sendResponse(resp.getWriter()); + } + } |