Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- post("/register", (req, res) -> {
- WebContext context = new SparkWebContext(req, res);
- ProfileManager manager = new ProfileManager(context);
- // todo - check if authed - if yes - decline
- String body = req.body().trim();
- GsonBuilder gsonBuilder = new GsonBuilder();
- gsonBuilder.registerTypeAdapter(RegistrationData.class, new RegistrationDeserializer());
- Gson gson = gsonBuilder.create();
- RegistrationData data;
- try{
- data = gson.fromJson(body, RegistrationData.class);
- }catch (JsonSyntaxException ex){
- return "fail";
- }
- userService.register(data);
- return "success " + data.getEmail();
- }, json());
- final CallbackRoute callback = new CallbackRoute(config, null, true);
- get("/callback", callback);
- post("/callback", callback);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement