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

Login loop in code editor when no $.user object for given ID #441

Open
2 tasks
cpcallen opened this issue Jan 28, 2021 · 0 comments
Open
2 tasks

Login loop in code editor when no $.user object for given ID #441

cpcallen opened this issue Jan 28, 2021 · 0 comments
Labels
bug core Things related to the "core" part of the database

Comments

@cpcallen
Copy link
Collaborator

A weird edge case which causes an unexpected login loop. To reproduce:

  • Start a fresh database from the current core (as of 9a58103).
  • Open a code editor for $.thing.name or any other unimportant property.
  • Use your browser URL bar padlock menu to delete the ID cookie, if present.
  • Make a trivial change to the property being edited (e.g. "The thing prototype").
  • Click "Save".
  • Note that a login window opens. Click "Sign In".
  • Note that the code editor now has a butter bar saying "User not logged in", and the login window has reopened.

The cause is that, although the login server has successfully set the ID cookie, there is no $.user object corresponding to this ID in $.userDatabase.byMd5, because at the moment user objects are only created by the telnet server.

This has the effect of making it impossible to have code-only Code City instances. Proposed fix:

  • Extract login and associated $.user-creation code to a general-purpose login function shared by both the telnet and http servers.
  • Ensure that any save which results in the ownership of an object (e.g., because it creates a Function object) is enough to prevent the owning $.user object from being .destroyed. We don't want a user who's never "created a character" being assigned a band-new $.user object for every save!
@cpcallen cpcallen added bug core Things related to the "core" part of the database labels Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core Things related to the "core" part of the database
Projects
None yet
Development

No branches or pull requests

1 participant