def change_password(self, previous, new_password):
        """
        Change the user's password and save to the database

        :param previous: plain text previous password
        :param new_password: plain text new password
        :raises: ValidationError
        """
        if not self.verify_password(previous):
            raise exceptions.Unauthorized('Incorrect password')

        if len(new_password) < options.min_length_password:
            msg = ('Passwords must be at least {} characters'
                   .format(options.min_length_password))
            raise exceptions.ValidationError(msg)

        if len(new_password) > options.max_length_password:
            msg = ('Passwords must be at no more than {} characters'
                   .format(options.max_length_password))
            raise exceptions.ValidationError(msg)

        self.password = self.hash_password(new_password)
        yield self._save()
Change the user's password and save to the database

        :param previous: plain text previous password
        :param new_password: plain text new password
        :raises: ValidationError