Explorar el Código

[useradmin] Disable password update for LDAP users

krish hace 11 años
padre
commit
48d4a45
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      apps/useradmin/src/useradmin/forms.py

+ 5 - 0
apps/useradmin/src/useradmin/forms.py

@@ -96,6 +96,11 @@ class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
     if self.instance.id:
       self.fields['username'].widget.attrs['readonly'] = True
 
+    if desktop_conf.AUTH.BACKEND.get() == 'desktop.auth.backend.LdapBackend':
+      self.fields['password1'].widget.attrs['readonly'] = True
+      self.fields['password2'].widget.attrs['readonly'] = True
+      self.fields['password_old'].widget.attrs['readonly'] = True
+
   def clean_password(self):
     return self.cleaned_data["password"]