mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Fix set password when no old password exists (#5562)
This commit is contained in:
		| @@ -161,6 +161,7 @@ class SetPasswordForm(HelperForm): | ||||
|     old_password = forms.CharField( | ||||
|         label=_("Old password"), | ||||
|         strip=False, | ||||
|         required=False, | ||||
|         widget=forms.PasswordInput(attrs={'autocomplete': 'current-password', 'autofocus': True}), | ||||
|     ) | ||||
|  | ||||
|   | ||||
| @@ -443,8 +443,7 @@ class SetPasswordView(AjaxUpdateView): | ||||
|  | ||||
|         if valid: | ||||
|             # Old password must be correct | ||||
|  | ||||
|             if not user.check_password(old_password): | ||||
|             if user.has_usable_password() and not user.check_password(old_password): | ||||
|                 form.add_error('old_password', _('Wrong password provided')) | ||||
|                 valid = False | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user