mirror of
				https://github.com/Tivix/django-rest-auth.git
				synced 2025-10-31 15:57:34 +03:00 
			
		
		
		
	fix bug in PasswordChangeSerializer
This commit is contained in:
		
							parent
							
								
									986dcd12c0
								
							
						
					
					
						commit
						7b7e2d368b
					
				|  | @ -136,10 +136,10 @@ class PasswordChangeSerializer(serializers.Serializer): | |||
|             self.fields.pop('old_password') | ||||
| 
 | ||||
|         self.request = self.context.get('request') | ||||
|         self.user = self.request.user | ||||
|         self.user = getattr(self.request, 'user', None) | ||||
| 
 | ||||
|     def validate_old_password(self, attrs, source): | ||||
|         if self.old_password_field_enabled and \ | ||||
|         if self.old_password_field_enabled and self.user and \ | ||||
|             not self.user.check_password(attrs.get(source, '')): | ||||
|             raise serializers.ValidationError('Invalid password') | ||||
|         return attrs | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user