umap icon indicating copy to clipboard operation
umap copied to clipboard

Redirect to the login view when login is required

Open davidbgk opened this issue 1 year ago • 6 comments

When the UMAP_ALLOW_ANONYMOUS setting is False, we return the login url through a JSON response. We lost that ability in #1555.

The JS part was not following that link in that particular case and lead to more errors because the map was not saved (hence, no map_id).

For now, the current work on the map is lost because of the redirection and we have a confirmation dialog to quit the edited page with unsaved changes.

Maybe we should display a custom message instead of a brutal redirection? Like: you’re not logged in, do it in a separate tab to keep you work? (A bit ugly…)

Sidenote: we might want to use the redirect pattern/key in the JSON response that we already use for deletion and clone for consistency.

davidbgk avatar Apr 05 '24 17:04 davidbgk

Thanks for the issue. I wonder: if the login is required, maybe we should login first before allowing the creation of a new map? 🤔

almet avatar Apr 06 '24 21:04 almet

Humm, but with this proposal, the data is lost, no ?

The tricky part, that was done before #1555, was:

  • sent a normal request
  • receive a login_required
  • to the login
  • send again the initial request
  • continue the js flow (sending other requests, etc.)

I wonder: if the login is required, maybe we should login first before allowing the creation of a new map? 🤔

There is an usage where users see a "prebuilt" map with remote data, so they can browse the data AND optionally save it later. Those users are not logged in. This is in use in the ANCT instance.: from the deveco app, people search for companies in their territory, and if they want to see it on a map, they are sent to uMap.

yohanboniface avatar Apr 15 '24 07:04 yohanboniface

We iterated on this with @Aurelie-Jallut and I should have report this here. We plan to add a modal window to explicitly state that it's in playground mode with data loss if no account is created/logged in.

davidbgk avatar Apr 15 '24 12:04 davidbgk

Two questions then:

  • is "playground mode" the situation where the uMap instance does not accept anonymous map and the user is not logged in ? (We should still keep in mind the "preloaded map" scenario)
  • does that mean we gived up on making the login working again during a save process (as before #1555) ?

yohanboniface avatar Apr 15 '24 13:04 yohanboniface

image(1)

To have it here too.

davidbgk avatar Apr 15 '24 15:04 davidbgk

🤔 It's not clear to me that I shouldn't go there by reading this message. Should we explicitly state that "You won't be able to save your edits"?

almet avatar Apr 15 '24 15:04 almet

Replaced by #2025

yohanboniface avatar Aug 15 '24 10:08 yohanboniface