Set changed time of an entity before validation runs to trigger EntityChangedConstraint consistently

Created on 11 November 2015, over 9 years ago
Updated 19 March 2025, 4 months ago

Problem/Motivation

In NodeForm we put the currently changed timestamp in the form and sent it to the client, for later overwrite error checking, so that we prevent the current user from saving the node, if the node got saved by another user in the meantime.

The problem is, we set the changed in the form as hidden default_value, which means the user might manipulate it.

Steps to reproduce:

  1. Create a node.
  2. Go to node/{node}/edit.
  3. Save the node in the background to cause the entity changed constraint validator to raise an error.
  4. Submit the form.
  5. As a result you get the validation error message " The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.".
  6. Now manipulate the changed timestamp and set it to the current time in the DOM using Firebug or whatever...
  7. Submit the form again.
  8. Watch how you succesfully overcome the entity changed constraint validator.

The attached test shows the problem.

Proposed resolution

None at the moment.

Remaining tasks

Find a solution of the problem.

User interface changes

none

API changes

none

Data model changes

none

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component

entity system

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024