diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/common/Configuration.java b/navalplanner-business/src/main/java/org/navalplanner/business/common/Configuration.java new file mode 100644 index 000000000..73e9437e6 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/common/Configuration.java @@ -0,0 +1,57 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2010-2011 Wireless Galicia, S.L. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.business.common; + +/** + * It contains the current version of project and implements of singleton + * pattern. + * @author Susana Montes Pedreira + */ +public class Configuration { + + private static final Configuration singleton = new Configuration(); + + private Boolean defaultPasswordsControl; + + private Configuration() { + } + + public static Configuration getInstance() { + return singleton; + } + + /** + * It returns the current state of the default passwords control in order to + * show or not warnings. + */ + public static Boolean isDefaultPasswordsControl() { + return singleton.getDefaultPasswordsControl() != null ? singleton + .getDefaultPasswordsControl() : true; + } + + public void setDefaultPasswordsControl(Boolean defaultPasswordsControl) { + this.defaultPasswordsControl = defaultPasswordsControl; + } + + public Boolean getDefaultPasswordsControl() { + return defaultPasswordsControl; + } + +} diff --git a/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml b/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml index cb6a9b3ef..65825cd2f 100644 --- a/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml +++ b/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml @@ -136,6 +136,15 @@ + + + ${default.passwords.control} + + + diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/users/UserModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/users/UserModel.java index ad29a3da4..bdd40cacd 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/users/UserModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/users/UserModel.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.Validate; +import org.navalplanner.business.common.Configuration; import org.navalplanner.business.common.Registry; import org.navalplanner.business.common.exceptions.InstanceNotFoundException; import org.navalplanner.business.common.exceptions.ValidationException; @@ -97,7 +98,9 @@ public class UserModel implements IUserModel { * changed and if so sets true in the field * changedDefaultAdminPassword. */ - checkIfChangeDefaultPasswd(); + if (Configuration.isDefaultPasswordsControl()) { + checkIfChangeDefaultPasswd(); + } user.setPassword(dbPasswordEncoderService.encodePassword( getClearNewPassword(), user.getLoginName())); @@ -195,6 +198,7 @@ public class UserModel implements IUserModel { public void initEdit(User user) { Validate.notNull(user); this.user = getFromDB(user); + this.setClearNewPassword(null); } @Transactional(readOnly = true) diff --git a/navalplanner-webapp/src/main/webapp/common/layout/template.zul b/navalplanner-webapp/src/main/webapp/common/layout/template.zul index bedca9a93..e137f71f7 100644 --- a/navalplanner-webapp/src/main/webapp/common/layout/template.zul +++ b/navalplanner-webapp/src/main/webapp/common/layout/template.zul @@ -24,6 +24,8 @@ + @@ -130,13 +132,13 @@ - +
${i18n:_('The admin account default password was not changed')}. [${i18n:_('Click here')}]
- +
${dataSource.user} ${dataSource.password} public. + + true