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

Email like usernames disallowed in all circumstances #11351

Closed
rtibbles opened this issue Oct 4, 2023 · 0 comments · Fixed by #11425
Closed

Email like usernames disallowed in all circumstances #11351

rtibbles opened this issue Oct 4, 2023 · 0 comments · Fixed by #11425
Assignees
Labels
P1 - important Priority: High impact on UX

Comments

@rtibbles
Copy link
Member

rtibbles commented Oct 4, 2023

Observed behavior

Currently email like usernames are disallowed via the Validation logic set in the backend: https://github.com/learningequality/kolibri/blob/release-v0.16.x/kolibri/core/auth/models.py#L367 this precludes the generation of FacilityUsers with email like usernames, unless created directly through the ORM (without doing a full_clean of the model prior to save), and also prevents their syncing, as Morango does a full_clean of the model during the deserialization process.

Expected behavior

There are certain circumstances where this is desirable - the main one being for use with the oidc-client-plugin, where the system being used for Open ID verification is using emails as the usernames.

To achieve this, but not cause a drastic change and a slew of non-backwards syncable FacilityUser accounts, we should move the username validation regex out of the model definition, and into the FacilityUserSerializer: https://github.com/learningequality/kolibri/blob/release-v0.16.x/kolibri/core/auth/serializers.py#L79

This will allow the OIDC client plugin to create these usernames, as it uses the create_user method of the FacilityUser manager class: https://github.com/learningequality/kolibri-oidc-client-plugin/blob/master/kolibri_oidc_client_plugin/auth.py#L83

The one side effect here is that users of this type will also be able to be created via the command line using management commands.

User-facing consequences

Difficulty integrating with systems where email is the primary username.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 - important Priority: High impact on UX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants