adds compiling option to disable the warning changing default password.
FEA : ItEr69S06AutocompleteAndPasswords
This commit is contained in:
parent
664a4baafd
commit
4aed9a22ad
5 changed files with 77 additions and 3 deletions
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.navalplanner.business.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It contains the current version of project and implements of singleton
|
||||||
|
* pattern.
|
||||||
|
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -136,6 +136,15 @@
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="configuration"
|
||||||
|
class="org.navalplanner.business.common.Configuration"
|
||||||
|
factory-method="getInstance"
|
||||||
|
lazy-init="false">
|
||||||
|
<property name="defaultPasswordsControl">
|
||||||
|
<value>${default.passwords.control}</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="scenarioManager"
|
<bean id="scenarioManager"
|
||||||
class="org.navalplanner.business.scenarios.OnlyMainScenarioAwareManager"
|
class="org.navalplanner.business.scenarios.OnlyMainScenarioAwareManager"
|
||||||
scope="singleton"/>
|
scope="singleton"/>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.navalplanner.business.common.Configuration;
|
||||||
import org.navalplanner.business.common.Registry;
|
import org.navalplanner.business.common.Registry;
|
||||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
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
|
* changed and if so sets true in the field
|
||||||
* changedDefaultAdminPassword.
|
* changedDefaultAdminPassword.
|
||||||
*/
|
*/
|
||||||
checkIfChangeDefaultPasswd();
|
if (Configuration.isDefaultPasswordsControl()) {
|
||||||
|
checkIfChangeDefaultPasswd();
|
||||||
|
}
|
||||||
|
|
||||||
user.setPassword(dbPasswordEncoderService.encodePassword(
|
user.setPassword(dbPasswordEncoderService.encodePassword(
|
||||||
getClearNewPassword(), user.getLoginName()));
|
getClearNewPassword(), user.getLoginName()));
|
||||||
|
|
@ -195,6 +198,7 @@ public class UserModel implements IUserModel {
|
||||||
public void initEdit(User user) {
|
public void initEdit(User user) {
|
||||||
Validate.notNull(user);
|
Validate.notNull(user);
|
||||||
this.user = getFromDB(user);
|
this.user = getFromDB(user);
|
||||||
|
this.setClearNewPassword(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
<?link rel="stylesheet" type="text/css" href="/common/css/navalplan_zk.css"?>
|
<?link rel="stylesheet" type="text/css" href="/common/css/navalplan_zk.css"?>
|
||||||
<?link rel="stylesheet" type="text/css" href="/common/css/perspectives.css"?>
|
<?link rel="stylesheet" type="text/css" href="/common/css/perspectives.css"?>
|
||||||
<?component name="customMenu" inline="true" macroURI="_customMenu.zul"?>
|
<?component name="customMenu" inline="true" macroURI="_customMenu.zul"?>
|
||||||
|
<?xel-method prefix="project" name="passwd_control" class="org.navalplanner.business.common.Configuration"
|
||||||
|
signature="java.lang.Boolean isDefaultPasswordsControl()"?>
|
||||||
|
|
||||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
|
|
||||||
|
|
@ -130,13 +132,13 @@
|
||||||
<n:img height="40" src="${templateCtrl.companyLogoURL}" if="${templateCtrl.companyLogoURL!=''}" />
|
<n:img height="40" src="${templateCtrl.companyLogoURL}" if="${templateCtrl.companyLogoURL!=''}" />
|
||||||
</n:td>
|
</n:td>
|
||||||
<n:td valign="center">
|
<n:td valign="center">
|
||||||
<n:div id="warningDefaultPasswdadmin" style="display:${templateCtrl.defaultPasswdAdminVisible}">
|
<n:div if="${project:passwd_control()}" id="warningDefaultPasswdadmin" style="display:${templateCtrl.defaultPasswdAdminVisible}">
|
||||||
<div>
|
<div>
|
||||||
<n:span class="footer-messages-area">${i18n:_('The admin account default password was not changed')}.</n:span>
|
<n:span class="footer-messages-area">${i18n:_('The admin account default password was not changed')}.</n:span>
|
||||||
<n:a href="${contextPath}/users/users.zul#edit%3D${idAdminUser}" class="footer-messages-area">[${i18n:_('Click here')}]</n:a>
|
<n:a href="${contextPath}/users/users.zul#edit%3D${idAdminUser}" class="footer-messages-area">[${i18n:_('Click here')}]</n:a>
|
||||||
</div>
|
</div>
|
||||||
</n:div>
|
</n:div>
|
||||||
<n:div id="warningDefaultPasswdOthers" style="display:${templateCtrl.defaultPasswdVisible}">
|
<n:div if="${project:passwd_control()}" id="warningDefaultPasswdOthers" style="display:${templateCtrl.defaultPasswdVisible}">
|
||||||
<div>
|
<div>
|
||||||
<n:a href="${contextPath}/users/users.zul#edit%3D${idUser}"
|
<n:a href="${contextPath}/users/users.zul#edit%3D${idUser}"
|
||||||
class="footer-messages-area" id="warningDefaultPasswduser"
|
class="footer-messages-area" id="warningDefaultPasswduser"
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -34,6 +34,8 @@
|
||||||
<testDataSource.user>${dataSource.user}</testDataSource.user>
|
<testDataSource.user>${dataSource.user}</testDataSource.user>
|
||||||
<testDataSource.password>${dataSource.password}</testDataSource.password>
|
<testDataSource.password>${dataSource.password}</testDataSource.password>
|
||||||
<databasetable.prefix>public.</databasetable.prefix>
|
<databasetable.prefix>public.</databasetable.prefix>
|
||||||
|
|
||||||
|
<default.passwords.control>true</default.passwords.control>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue