Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to the login view when login is required #1733

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidbgk
Copy link
Contributor

@davidbgk davidbgk commented Apr 5, 2024

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.

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.
@almet
Copy link
Member

almet commented Apr 6, 2024

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

@yohanboniface
Copy link
Member

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.

@davidbgk
Copy link
Contributor Author

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 davidbgk marked this pull request as draft April 15, 2024 12:57
@yohanboniface
Copy link
Member

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 chore: move xhr management to a module and refactor #1555) ?

@davidbgk
Copy link
Contributor Author

image(1)

To have it here too.

@almet
Copy link
Member

almet commented Apr 15, 2024

🤔 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"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants