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

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

Introduction

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

Prototype

String MAIL_HOOK_SENDMAIL_CHANGE_PASSWORD

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

Click Source Link

Usage

From source file:com.liferay.mail.util.SendmailHook.java

License:Open Source License

public void updatePassword(long companyId, long userId, String password) {

    // Get change password command

    String changePasswordCmd = PropsUtil.get(PropsKeys.MAIL_HOOK_SENDMAIL_CHANGE_PASSWORD);

    // Replace userId

    changePasswordCmd = StringUtil.replace(changePasswordCmd, "%1%", String.valueOf(userId));

    // Replace password

    changePasswordCmd = StringUtil.replace(changePasswordCmd, "%2%", password);

    Runtime rt = Runtime.getRuntime();

    try {/*from w  w  w  .j  a  va 2  s  . co m*/
        Process p = rt.exec(changePasswordCmd);

        ProcessUtil.close(p);
    } catch (Exception e) {
        _log.error(e, e);
    }
}