Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public Result changeEmail(){
  2. if(session("login")==null)
  3. return badRequest("you didn't authorize");
  4. JsonNode json;
  5. try{
  6. json = request().body().asJson();
  7. }
  8. catch (Exception e){
  9. return notAcceptable("no body json");
  10.  
  11. }
  12. String email = json.findValue("email").asText();
  13. if(email==null)
  14. return notAcceptable("no email");
  15. Пользователь user = Пользователь.find.query().where().eq("name",session("login")).findUnique();
  16. user.email=email;
  17. return ok("email changed");
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement