1 /*******************************************************************************
2 * Copyright © Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
4 * This file is part of the work and learning management system Pentila Nero.
6 * Pentila Nero is free software. You can redistribute it and/or modify since
7 * you respect the terms of either (at least one of the both license) :
8 * - under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 * - the CeCILL-C as published by CeCILL-C; either version 1 of the
12 * License, or any later version
13 * - the GNU Lesser General Public License as published by the
14 * Free Software Foundation, either version 3 of the license,
15 * or (at your option) any later version.
17 * There are special exceptions to the terms and conditions of the
18 * licenses as they are applied to this software. View the full text of
19 * the exception in file LICENSE-PROJECT.txt in the directory of this software
22 * Pentila Nero is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * Licenses for more details.
27 * You should have received a copy of the GNU Affero General Public License
28 * and the CeCILL-C and the GNU Lesser General Public License along with
29 * Pentila Nero. If not, see :
30 * <http://www.gnu.org/licenses/> and
31 * <http://www.cecill.info/licences.fr.html>.
32 ******************************************************************************/
33 package com.pentila.entSavoie.actions;
35 import javax.servlet.http.HttpServletRequest;
36 import javax.servlet.http.HttpServletResponse;
38 import com.liferay.portal.kernel.events.Action;
39 import com.liferay.portal.kernel.events.ActionException;
40 import com.liferay.portal.kernel.exception.PortalException;
41 import com.liferay.portal.kernel.exception.SystemException;
42 import com.liferay.portal.kernel.log.Log;
43 import com.liferay.portal.kernel.log.LogFactoryUtil;
44 import com.liferay.portal.model.User;
45 import com.liferay.portal.service.UserLocalServiceUtil;
46 import com.liferay.portal.util.PortalUtil;
47 import com.pentila.entSavoie.utils.ENTMainUtilsLocalServiceUtil;
50 * @author Lancelot SIX
52 *Cet action vas se derouler au premier login de l'utilisateur. Si celui-ci
53 *n'a pas accepte les conditions d'utilisation (pour atester du first login),
54 *alors une demande de reset de mot de passe est mise en place.
57 public class UpdatePasswordRequestOnLoginAction extends Action {
60 public void run(HttpServletRequest arg0, HttpServletResponse arg1)
61 throws ActionException {
63 final User currUser = PortalUtil.getUser(arg0);
64 //if (!currUser.getAgreedToTermsOfUse()) {
65 //Si le mot de passe n'a jamais ete reinitialise, alors on en fait
67 if (!ENTMainUtilsLocalServiceUtil.isSchemaSupann(currUser.getCompanyId())){
68 if (currUser.getPasswordModifiedDate()==null) {
69 UserLocalServiceUtil.updatePasswordReset(currUser.getUserId(), true);
72 } catch (PortalException e) {
73 if (_log.isErrorEnabled()) {
76 } catch (SystemException e) {
77 if (_log.isErrorEnabled()) {
83 private Log _log = LogFactoryUtil.getLog(this.getClass());