浏览代码

[useradmin] Disable password update for LDAP users

krish 11 年之前
父节点
当前提交
48d4a45
共有 1 个文件被更改,包括 5 次插入0 次删除
  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:
     if self.instance.id:
       self.fields['username'].widget.attrs['readonly'] = True
       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):
   def clean_password(self):
     return self.cleaned_data["password"]
     return self.cleaned_data["password"]