Repository navigation
fix(users): one first account, and less said without a sign-in - #12
Merged
Merged
Conversation
A key from GET /v1/users/status created an administrator for as long as it was kept: every visit before the box was set up got one, and only the one used was forgotten. A key now creates the first account and no other, the table is emptied after it, and a lock covers the whole registration. /login needs no account, and had one budget for everybody: any machine on the network spent it and the owner could not sign in. Strangers keep that shared budget, five tries and one a minute; an address a sign-in succeeded from has its own. GET /v1/users/image served any file in a user's folder, the dashboard's settings among them. It serves pictures only, from a user's folder only, and looks at the folder before the disk. GetImageExt closes the file it opens. GET /v1/users/name, the list of accounts, needs a sign-in.
inkly
marked this pull request as ready for review
November 10, 2026 10:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four changes to what the user service does for somebody who has not signed in. Each has a test that failed first.
Registration. A key from
GET /v1/users/statuscreates the first account and no other: the registration is refused once an account exists, the table of keys is emptied after the first one, and a lock covers the whole registration so two keys used at the same moment make one account.Sign-in budget.
/loginhad one budget for everybody, so one noisy machine on the network kept the owner out. Strangers keep that shared budget, unchanged. An address a sign-in succeeded from gets a budget of its own.GET /v1/users/image. The sign-in page needs it without a token for the avatar and the wallpaper. It now serves pictures only, by the two rules a picture gets in by (its name for an upload, its content for one taken from Files), from<UserDataPath>/<id>/only. The folder check usesUserDataPathin place of a hard-coded/var/lib/casaos.GetImageExtcloses the file it opens.GET /v1/users/name. It moves behind the token. The dashboard does not call it.Tests. Four new tests in
route/v1_public_test.go;TestVerifyOutsideLoginLimiterand the test rig move to the new budget.go vet ./...andgo test ./... -count=1pass on my Windows machine;-racewas not run there. Nothing was tried on a real box.