* @param response the HttpServletResponse instance
* @return the name of the next view
*/
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);
String name = request.getParameter("name");
String emailAddress = request.getParameter("emailAddress");
String website = request.getParameter("website");
String profile = request.getParameter("profile");
PebbleUserDetails currentUserDetails = SecurityUtils.getUserDetails();
// can the user change their user details?
if (!currentUserDetails.isDetailsUpdateable()) {
return new FourZeroThreeView();
}
SecurityRealm realm = PebbleContext.getInstance().getConfiguration().getSecurityRealm();
PebbleUserDetails newUserDetails;
ValidationContext validationContext = new ValidationContext();
if (!validationContext.hasErrors()) {
newUserDetails = new PebbleUserDetails(
currentUserDetails.getUsername(),
name,
emailAddress,
website,
profile,
currentUserDetails.getRoles(),
currentUserDetails.getPreferences(),
currentUserDetails.isDetailsUpdateable());
realm.updateUser(newUserDetails);
return new RedirectView(blog.getUrl() + "editUserDetails.secureaction");
}
getModel().put("validationContext", validationContext);
return new ForwardView("/editUserDetails.secureaction");
} catch (SecurityRealmException e) {