001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.login.action;
016    
017    import com.liferay.portal.kernel.portlet.DefaultConfigurationAction;
018    import com.liferay.portal.kernel.util.LocaleUtil;
019    import com.liferay.portal.util.PropsValues;
020    import com.liferay.util.ContentUtil;
021    
022    import javax.portlet.ActionRequest;
023    import javax.portlet.ActionResponse;
024    import javax.portlet.PortletConfig;
025    import javax.portlet.PortletPreferences;
026    import javax.portlet.PortletRequest;
027    
028    /**
029     * @author Brian Wing Shun Chan
030     * @author Julio Camarero
031     */
032    public class ConfigurationActionImpl extends DefaultConfigurationAction {
033    
034            @Override
035            public void postProcess(
036                    long companyId, PortletRequest portletRequest,
037                    PortletPreferences portletPreferences) {
038    
039                    String languageId = LocaleUtil.toLanguageId(
040                            LocaleUtil.getSiteDefault());
041    
042                    removeDefaultValue(
043                            portletRequest, portletPreferences,
044                            "emailPasswordResetBody_" + languageId,
045                            ContentUtil.get(PropsValues.ADMIN_EMAIL_PASSWORD_RESET_BODY));
046                    removeDefaultValue(
047                            portletRequest, portletPreferences,
048                            "emailPasswordResetSubject_" + languageId,
049                            ContentUtil.get(PropsValues.ADMIN_EMAIL_PASSWORD_RESET_SUBJECT));
050                    removeDefaultValue(
051                            portletRequest, portletPreferences,
052                            "emailPasswordSentBody_" + languageId,
053                            ContentUtil.get(PropsValues.ADMIN_EMAIL_PASSWORD_SENT_BODY));
054                    removeDefaultValue(
055                            portletRequest, portletPreferences,
056                            "emailPasswordSentSubject_" + languageId,
057                            ContentUtil.get(PropsValues.ADMIN_EMAIL_PASSWORD_SENT_SUBJECT));
058            }
059    
060            @Override
061            public void processAction(
062                            PortletConfig portletConfig, ActionRequest actionRequest,
063                            ActionResponse actionResponse)
064                    throws Exception {
065    
066                    validateEmailFrom(actionRequest);
067    
068                    super.processAction(portletConfig, actionRequest, actionResponse);
069            }
070    
071    }