Changes between Version 2 and Version 3 of Ticket #28751
- Timestamp:
- Oct 29, 2017, 9:42:32 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28751 – Description
v2 v3 1 In admin login site, I found that error message for 'inactive' user does not exist. (In AuthenticationForm it exists) I know default BackEnd checks the inactive in user_can_authenticate() method, but I think this error message ishelpful if using other BackEnd like AllowAllUsersModelBackEnd.1 In admin login site, I found that ValidationError message for 'inactive' user does not exist. (In AuthenticationForm it exists) I know default BackEnd checks the is_active in user_can_authenticate() method, but I think adding this error message would be helpful if using other BackEnd like AllowAllUsersModelBackEnd. 2 2 3 In AuthenticationForm, 3 In AuthenticationForm, it shows inactive error message to the inactive user(user that `is_active=False`) 4 4 {{{ 5 5 def confirm_login_allowed(self, user): … … 12 12 }}} 13 13 14 but in AdminAuthenticationForm, 14 but in AdminAuthenticationForm, it shows invalid_login error message to the inactive user(user that `is_active=False`) 15 15 16 16 {{{ … … 23 23 ) 24 24 }}} 25 26 So I suggest to change it like 27 28 {{{ 29 error_messages = { 30 ... 31 'inactive': _("This account is inactive."), 32 } 33 34 ... 35 def confirm_login_allowed(self, user): 36 if not user.is_active: 37 raise forms.ValidationError( 38 self.error_messages['inactive'], 39 code='inactive', 40 ) 41 42 if not user.is_staff: 43 raise forms.ValidationError( 44 self.error_messages['invalid_login'], 45 code='invalid_login', 46 params = {'username': self.username_field.verbose_name}, 47 ) 48 .... 49 }}}