Disallow to change passwords to LDAP users

FEA: ItEr76S12LdapAuhentication
This commit is contained in:
Ignacio Diaz Teijido 2012-02-17 16:03:34 +01:00 committed by Manuel Rego Casasnovas
parent d2e7de5b83
commit c75fe8ba64
2 changed files with 11 additions and 3 deletions

View file

@ -23,6 +23,7 @@ import static org.libreplan.web.I18nHelper._;
import org.apache.commons.lang.StringUtils;
import org.libreplan.business.common.exceptions.ValidationException;
import org.libreplan.web.UserUtil;
import org.libreplan.web.common.ConstraintChecker;
import org.libreplan.web.common.IMessagesForUser;
import org.libreplan.web.common.Level;
@ -81,6 +82,10 @@ public class PasswordController extends GenericForwardComposer {
passwordModel.setPassword(password);
}
public boolean getLdapUser() {
return !UserUtil.getUserFromSession().isLibrePlanUser();
}
public Constraint validatePasswordConfirmation() {
return new Constraint() {
@Override

View file

@ -44,6 +44,9 @@
<tabpanel>
<groupbox style="margin-top: 5px" closable="false">
<caption label="${i18n:_('Password settings')}" />
<vbox visible="@{passwordController.ldapUser}">
<label value="${i18n:_('LDAP users cannot change their password if LDAP authentication is enabled. Talk to one of the administrators')}" />
</vbox>
<grid fixedLayout="true" id="personalData">
<columns>
<column width="200px" />
@ -54,19 +57,19 @@
<label value="${i18n:_('Current password')}" />
<textbox id="currentPassword" type="password"
constraint="@{passwordController.validateCurrentPassword}"
width="300px"/>
width="300px" disabled="@{passwordController.ldapUser}"/>
</row>
<row>
<label value="${i18n:_('New password')}" />
<textbox id="password" type="password"
onChange="passwordController.setPassword(self.value);"
width="300px"/>
width="300px" disabled="@{passwordController.ldapUser}"/>
</row>
<row>
<label value="${i18n:_('Password confirmation')}" />
<textbox id="passwordConfirmation" type="password"
constraint="@{passwordController.validatePasswordConfirmation}"
width="300px"/>
width="300px" disabled="@{passwordController.ldapUser}"/>
</row>
</rows>
</grid>