BallStateCBER / commentaries-cake3

CBER Data Center: Weekly Commentary
0 stars 0 forks source link

Changes to user record not reflected in form #26

Open PhantomWatson opened 6 years ago

PhantomWatson commented 6 years ago

Because in UsersController::myAccount(), $this->set(compact('user')); comes before $user is modified by the request data, the form always displays what data was in the database before it was changed, rather than the request data that updated what was in the database.

Example:

  1. User's gender is "walrus"
  2. User goes to /users/my-account, changes it to "geode", and submits the form
  3. The database shows the user's gender as being changed to "geode"
  4. The resulting page displays "Your account has been updated", but the form still shows the gender as "walrus"
  5. Refreshing that page queries the database again, and the form now shows the updated gender