Signup fixes: username validation, ORCID pre-fill, and CDM sidebar role gate#258
Open
dauglyon wants to merge 3 commits into
Open
Signup fixes: username validation, ORCID pre-fill, and CDM sidebar role gate#258dauglyon wants to merge 3 commits into
dauglyon wants to merge 3 commits into
Conversation
The frontend availability check compared availablename to username.toLowerCase(), so a username like "John" passed validation but was then rejected by auth2 for the uppercase letter. Inputs with characters auth2 strips (dots, hyphens, etc.) failed with a misleading "Username is not available" message. Mirror the kbase/auth2 NewUserName rules on the form: must start with a lowercase letter, only [a-z0-9_], no repeating or trailing underscores, at most 100 chars. Show a specific error for format violations and only treat availability mismatches as collisions.
The CDM nav item was gated on CDM_JUPYTERHUB_ADMIN, so only admins saw the link. Per the BERDL platform docs, BERDL_USER is the role that gates access to the lakehouse; CDM_JUPYTERHUB_ADMIN is a separate admin role for approving access requests.
ORCID's provider-supplied username is the numeric ORCID iD (e.g. 0000-0002-1825-0097). auth2's NewUserName.sanitizeName strips all of that to empty and getAvailableUserName falls back to user<N>, so every ORCID signup landed on the form with user1 (or user2, ...) already in the username field. Leave the username blank when the provider is OrcID so the user picks their own. Display name and email pre-fill are unchanged.
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.
Summary
Three small fixes around signup and the authenticated sidebar.
kbase/auth2NewUserNamerules on the signup form: must start with a lowercase letter, only[a-z0-9_], no repeating or trailing underscores, ≤100 chars. The availability check previously comparedavailablenametousername.toLowerCase(), so inputs likeJohnpassed the frontend check and were then rejected by the backend. Special-character inputs (John.Doe,bad-user, …) reported "Username is not available — Suggested: X" which was actually a format problem, not a collision. Now the form shows a specific format error and submit stays blocked until the input matches the backend rules.user<N>pre-fill on ORCID signup: ORCID's provider-supplied username is the numeric ORCID iD (e.g.0000-0002-1825-0097). auth2'sNewUserName.sanitizeNamestrips all of that to empty andgetAvailableUserNamefalls back to the literaluser<N>(seeAuthentication.java:1185-1196andDEFAULT_SUGGESTED_USER_NAME). The signup form was pre-populating the username field withuser1/user2/etc. for every ORCID signup. Leave the field blank when the provider isOrcIDso the user picks their own. Display name and email pre-fill from ORCID are unchanged.CDM_JUPYTERHUB_ADMIN(admin only). Per the BERDL platform docs,BERDL_USERis the access role;CDM_JUPYTERHUB_ADMINis a separate admin role for approving access requests. Switch the gate so users withBERDL_USERsee the link.Test plan
Signup username validation
John) — submit stays blocked, format error shown.bad-user,bad__user,baduser_,1baduser— submit stays blocked with format error.testuser) — submit proceeds to step 3.>100 chars shows the "must be at most 100 characters" error.ORCID signup pre-fill
user1).availablename.CDM sidebar gate
BERDL_USERbut no admin role — CDM link visible in sidebar.BERDL_USER— CDM link not visible.Unit tests
npm test -- --testPathPattern='src/features/signup/'— all 22 tests pass (includes 6 new parameterized format-error cases and 3 newsetLoginDatacases).