@RequestMapping(value = "/update-email", method = RequestMethod.GET)
  @RequireHardLogIn
  public String editEmail(final Model model) throws CMSItemNotFoundException {
    final CustomerData customerData = customerFacade.getCurrentCustomer();
    final UpdateEmailForm updateEmailForm = new UpdateEmailForm();

    updateEmailForm.setEmail(customerData.getDisplayUid());

    model.addAttribute("updateEmailForm", updateEmailForm);

    storeCmsPageInModel(model, getContentPageForLabelOrId(PROFILE_CMS_PAGE));
    setUpMetaDataForContentPage(model, getContentPageForLabelOrId(PROFILE_CMS_PAGE));
    model.addAttribute(
        "breadcrumbs", accountBreadcrumbBuilder.getBreadcrumbs("text.account.profile"));
    model.addAttribute("metaRobots", "no-index,no-follow");
    return ControllerConstants.Views.Pages.Account.AccountProfileEmailEditPage;
  }
  @RequestMapping(value = "/update-profile", method = RequestMethod.POST)
  @RequireHardLogIn
  public String updateProfile(
      final UpdateProfileForm updateProfileForm,
      final BindingResult bindingResult,
      final Model model,
      final RedirectAttributes redirectAttributes)
      throws CMSItemNotFoundException {
    getProfileValidator().validate(updateProfileForm, bindingResult);

    String returnAction = ControllerConstants.Views.Pages.Account.AccountProfileEditPage;
    final CustomerData currentCustomerData = customerFacade.getCurrentCustomer();
    final CustomerData customerData = new CustomerData();
    customerData.setTitleCode(updateProfileForm.getTitleCode());
    customerData.setFirstName(updateProfileForm.getFirstName());
    customerData.setLastName(updateProfileForm.getLastName());
    customerData.setUid(currentCustomerData.getUid());
    customerData.setDisplayUid(currentCustomerData.getDisplayUid());

    model.addAttribute("titleData", userFacade.getTitles());

    if (bindingResult.hasErrors()) {
      GlobalMessages.addErrorMessage(model, "form.global.error");
    } else {
      try {
        customerFacade.updateProfile(customerData);
        GlobalMessages.addFlashMessage(
            redirectAttributes,
            GlobalMessages.CONF_MESSAGES_HOLDER,
            "text.account.profile.confirmationUpdated",
            null);
        returnAction = REDIRECT_TO_PROFILE_PAGE;
      } catch (final DuplicateUidException e) {
        bindingResult.rejectValue("email", "registration.error.account.exists.title");
        GlobalMessages.addErrorMessage(model, "form.global.error");
      }
    }

    storeCmsPageInModel(model, getContentPageForLabelOrId(PROFILE_CMS_PAGE));
    setUpMetaDataForContentPage(model, getContentPageForLabelOrId(PROFILE_CMS_PAGE));
    model.addAttribute(
        "breadcrumbs", accountBreadcrumbBuilder.getBreadcrumbs("text.account.profile"));
    return returnAction;
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.energizer.facades.accounts.EnergizerCompanyB2BCommerceFacade#updateProfile(de.hybris.platform.commercefacades
  * .user.data.CustomerData)
  */
 @SuppressWarnings("deprecation")
 @Override
 public void updateProfile(final CustomerData customerData) {
   try {
     validateDataBeforeUpdate(customerData);
     final String name =
         getCustomerNameStrategy()
             .getName(customerData.getFirstName(), customerData.getLastName());
     final EnergizerB2BCustomerModel customer =
         (EnergizerB2BCustomerModel) getCurrentSessionCustomer();
     customer.setOriginalUid(customerData.getDisplayUid());
     customer.setContactNumber(customerData.getContactNumber());
     customerAccountService.updateProfile(
         customer, customerData.getTitleCode(), name, customerData.getUid());
     getModelService().save(customer);
   } catch (final DuplicateUidException e) {
     e.printStackTrace();
   }
 }
  public String editUser(final String user, final Model model) throws CMSItemNotFoundException {
    if (!model.containsAttribute("b2BCustomerForm")) {
      final CustomerData customerData = companyB2BCommerceFacade.getCustomerDataForUid(user);
      final B2BCustomerForm b2bCustomerForm = new B2BCustomerForm();
      b2bCustomerForm.setUid(customerData.getUid());
      b2bCustomerForm.setTitleCode(customerData.getTitleCode());
      b2bCustomerForm.setFirstName(customerData.getFirstName());
      b2bCustomerForm.setLastName(customerData.getLastName());
      b2bCustomerForm.setEmail(customerData.getDisplayUid());
      b2bCustomerForm.setParentB2BUnit(
          b2bCommerceUserFacade.getParentUnitForCustomer(customerData.getUid()).getUid());
      b2bCustomerForm.setActive(customerData.isActive());
      b2bCustomerForm.setApproverGroups(customerData.getApproverGroups());
      b2bCustomerForm.setApprovers(customerData.getApprovers());
      b2bCustomerForm.setRoles(customerData.getRoles());
      model.addAttribute(b2bCustomerForm);
    }

    model.addAttribute("titleData", getUserFacade().getTitles());
    model.addAttribute("roles", populateRolesCheckBoxes(companyB2BCommerceFacade.getUserGroups()));

    storeCmsPageInModel(model, getContentPageForLabelOrId(ORGANIZATION_MANAGEMENT_CMS_PAGE));
    setUpMetaDataForContentPage(
        model, getContentPageForLabelOrId(ORGANIZATION_MANAGEMENT_CMS_PAGE));
    final List<Breadcrumb> breadcrumbs =
        myCompanyBreadcrumbBuilder.createManageUserDetailsBreadcrumb(user);
    breadcrumbs.add(
        new Breadcrumb(
            String.format(
                "/my-company/organization-management/manage-users/edit?user=%s", urlEncode(user)),
            getMessageSource()
                .getMessage(
                    "text.company.manageusers.edit",
                    new Object[] {user},
                    "Edit {0} User",
                    getI18nService().getCurrentLocale()),
            null));
    model.addAttribute("breadcrumbs", breadcrumbs);
    model.addAttribute("metaRobots", "no-index,no-follow");
    return ControllerConstants.Views.Pages.MyCompany.MyCompanyManageUserAddEditFormPage;
  }