List of usage examples for com.liferay.portal.kernel.service UserLocalServiceUtil sendPassword
public static boolean sendPassword(long companyId, String emailAddress, String fromName, String fromAddress, String subject, String body, ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException
From source file:com.liferay.login.web.internal.portlet.util.LoginUtil.java
License:Open Source License
public static void sendPassword(ActionRequest actionRequest, String fromName, String fromAddress, String toAddress, String subject, String body) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Company company = themeDisplay.getCompany(); if (!company.isSendPassword() && !company.isSendPasswordResetLink()) { return;//from w w w. j a va2s .c om } ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); UserLocalServiceUtil.sendPassword(company.getCompanyId(), toAddress, fromName, fromAddress, subject, body, serviceContext); }
From source file:it.sysdata.base.service.impl.UserHelper_1_1ServiceImpl.java
License:Open Source License
@Override @AccessControlled(guestAccessEnabled = true) @JSONWebService(value = "send-new-password", method = "POST") public User sendNewPassword(String emailAddress) throws PortalException, SystemException { ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); String adminEmailFromName = PrefsPropsUtil.getString(serviceContext.getCompanyId(), PropsKeys.ADMIN_EMAIL_FROM_NAME); String adminEmailFromAddress = PrefsPropsUtil.getString(serviceContext.getCompanyId(), PropsKeys.ADMIN_EMAIL_FROM_ADDRESS); String adminEmailPasswordResetSubject = PrefsPropsUtil.getContent(serviceContext.getCompanyId(), PropsKeys.ADMIN_EMAIL_PASSWORD_RESET_SUBJECT); String adminEmailPasswordResetBody = PrefsPropsUtil.getContent(serviceContext.getCompanyId(), PropsKeys.ADMIN_EMAIL_PASSWORD_RESET_BODY); UserLocalServiceUtil.sendPassword(serviceContext.getCompanyId(), emailAddress, adminEmailFromName, adminEmailFromAddress, adminEmailPasswordResetSubject, adminEmailPasswordResetBody, serviceContext); User user = UserLocalServiceUtil.getUserByEmailAddress(serviceContext.getCompanyId(), emailAddress); return user;/*from w w w . j av a 2s .c o m*/ }