Example usage for com.liferay.portal.kernel.util PropsKeys ADMIN_EMAIL_PASSWORD_RESET_SUBJECT

List of usage examples for com.liferay.portal.kernel.util PropsKeys ADMIN_EMAIL_PASSWORD_RESET_SUBJECT

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys ADMIN_EMAIL_PASSWORD_RESET_SUBJECT.

Prototype

String ADMIN_EMAIL_PASSWORD_RESET_SUBJECT

To view the source code for com.liferay.portal.kernel.util PropsKeys ADMIN_EMAIL_PASSWORD_RESET_SUBJECT.

Click Source Link

Usage

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;/* w  ww. j  a  v a2  s.c o m*/
}