-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Username validation #11739
Username validation #11739
Conversation
Build Artifacts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @nick2432 I don't think that DeviceProvisionSerializer
is the proper place to do this. In the related issue this PR tries to fix there's a comment from @rtibbles
suggesting to do it in the public api that responds with the data of the username if it exists https://github.com/learningequality/kolibri/blob/release-v0.16.x/kolibri/core/public/api.py#L360
That's a safer place in the code (it does not create anything) and covers a more general case than the device provisioning (more users could be synced in the future not being superusers so you would not find them)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @nick2432
I'm afraid this is not working properly because the frontend is not using the username info this api provides, but the username the user typed in the text input. For this reason, the last post the frontend does to the server is not using the right capitalization but the wrong the user typed.
This is the last endpoint the setup uses:
/api/device/deviceprovision/
in my tests, the username was cincO
and with your api changes, it's correctly returned, but you can see the payload of the endpoint POST has not it corrected:
{"facility_id":"440eb55977625f4e82f1e9eef75769db","superuser":{"username":"cinco","password":"NOT_SPECIFIED"},"settings":{"on_my_own_setup":false},"preset":"nonformal","language_id":"en","device_name":"ddd","allow_guest_access":false,"is_provisioned":true,"is_soud":true}
So this is is the response to the browser:
{"detail":"
username,
password, or
full_nameare missing in
superuser"}
I understand this is the reason why you modified the provisioning serializer first, but, as previously mentioned, that didn't solve a general case. I'm afraid this issue requires both backend and frontend work to be finished. Please let us know if you need help with the frontend or you can achieve it.
Thanks!
@jredrejo , |
Hey, @jredrejo , please check out my latest changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @nick2432
fc94f27
into
learningequality:release-v0.16.x
Hi @nick2432 and @jredrejo I just tried this and I am still getting an error when trying to import a learner with the incorrect letter case in the username. My question is - since this was merged without requiring any QA verification - is this a partial fix of the issue described in #11540? 2024-01-23_15-46-57.mp4 |
@pcenov do you mean you want the password to be accepted when capitalization does not match? that's not possible. This PR fixes username validation when capitalization does not match. |
Hey @pcenov , I believe it's not a case issue. It's not working with both capital and lowercase letters; every username is encountering an error. 2024-01-23.22-34-13.mp4 |
Summary
FacilitySearchUsernameViewSet
to useusername__iexact
for case-insensitive username search.…
References
Fixes #11540
Screenshots
I created a user "cincO" and logged in with the username "cinco," and it worked
Uploading 2024-01-19 16-33-50.mp4…
…
Reviewer guidance
…
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)