소스 검색

[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:
       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"]