ODM2 / ODM2DataSharingPortal

A Python-Django web application enabling users to upload, share, and display data from their environmental monitoring sites via the app's ODM2 database. Data can either be automatically streamed from Internet of Things (IoT) devices, manually uploaded via CSV files, or manually entered into forms.
BSD 3-Clause "New" or "Revised" License
31 stars 8 forks source link

Fix next page after Cognito login #635

Closed aufdenkampe closed 1 year ago

aufdenkampe commented 1 year ago

When I first logged after setting up a new password, I was sent to https://staging.monitormywatershed.org/login_failed/ and got a 500 Gateway error.

However, when I when back to https://staging.monitormywatershed.org/, and logged in from there, the Cognito remembered that I had been previously logged in with my username. When I proceeded, it all worked fine!

ptomasula commented 1 year ago

@aufdenkampe

I was not able to reproduce this error. That might have something to do with my fix in commit ecc4097, but that code should be on staging was we added prior to you opening this issue.

I definitely want to make sure we have this resolved before we release though. Would you mind trying to reproduce this issue again?

ptomasula commented 1 year ago

@aufdenkampe,

I think I figured out part of the issue. My new commit 7c80506 fixes an incorrect path in the login_failed endpoint. That likely explains the 500 response that you received, however that doesn't explain why why your first logging after setting the new password failed. So I think there is probably still a need for additional testing.

aufdenkampe commented 1 year ago

@ptomasula, it might explain my error. I experience the error immediately after setting my account password, so it wasn't from the normal pathway. It worked fine as soon as I tried logging in from a fresh start. If you can't reproduce it, I'm OK with moving forward with having others test the process on Staging.

ptomasula commented 1 year ago

Some of the Stroud Center team also reported similar issues with the version presently on staging. I tracked the error down to the update method of our ORM implementation. The update method drops the the key value pair from the dictionary provided as an argument if that dictionary key equals the primary field name. This results in a KeyError being raised a few lines later when the cognito code was trying to reference the primary key field in the same dictionary.

I fixed this with commit 9a74fba which adds back in the dropped primary key after the update occurs.