@RequestProcessing(value="/admin/user/{userId}/email",method=HTTPRequestMethod.POST) @Before(adviceClass={StopwatchStartAdvice.class,AdminCheck.class}) @After(adviceClass=StopwatchEndAdvice.class) public void updateUserEmail(final HTTPRequestContext context,final HttpServletRequest request,final HttpServletResponse response,final String userId) throws Exception {
  final JSONObject user=userQueryService.getUser(userId);
  final String oldEmail=user.optString(User.USER_EMAIL);
  final String newEmail=request.getParameter(User.USER_EMAIL);
  if (oldEmail.equals(newEmail)) {
    response.sendRedirect(Latkes.getServePath() + "/admin/user/" + userId);
    return;
  }
  user.put(User.USER_EMAIL,newEmail);
  try {
    userMgmtService.updateUserEmail(userId,user);
  }
 catch (  final ServiceException e) {
    final AbstractFreeMarkerRenderer renderer=new SkinRenderer();
    context.setRenderer(renderer);
    renderer.setTemplateName("admin/error.ftl");
    final Map<String,Object> dataModel=renderer.getDataModel();
    dataModel.put(Keys.MSG,e.getMessage());
    filler.fillHeaderAndFooter(request,response,dataModel);
    return;
  }
  response.sendRedirect(Latkes.getServePath() + "/admin/user/" + userId);
}

@ RequestProcessing ( value = "/admin/user/{userId}/email" , method = HTTPRequestMethod . POST ) @ Before ( adviceClass = { StopwatchStartAdvice . class , AdminCheck . class } ) @ After ( adviceClass = StopwatchEndAdvice . class ) public void updateUserEmail ( final HTTPRequestContext context , final HttpServletRequest request , final HttpServletResponse response , final String userId ) throws Exception { final JSONObject user = userQueryService . getUser ( userId ) ; final String oldEmail = user . optString ( User . USER_EMAIL ) ; final String newEmail = request . getParameter ( User . USER_EMAIL ) ; if ( oldEmail . equals ( newEmail ) ) { response . sendRedirect ( Latkes . getServePath ( ) + "/admin/user/" + userId ) ; return ; } user . put ( User . USER_EMAIL , newEmail ) ; try { userMgmtService . updateUserEmail ( userId , user ) ; } catch ( final ServiceException e ) { final AbstractFreeMarkerRenderer renderer = new SkinRenderer ( ) ; context . setRenderer ( renderer ) ; renderer . setTemplateName ( "admin/error.ftl" ) ; final Map < String , Object > dataModel = renderer . getDataModel ( ) ; dataModel . put ( Keys . MSG , e . getMessage ( ) ) ; filler . fillHeaderAndFooter ( request , response , dataModel ) ; return ; } response . sendRedirect ( Latkes . getServePath ( ) + "/admin/user/" + userId ) ; }
updates a user ' s email .
