mirror of
https://github.com/lldap/lldap.git
synced 2026-04-25 16:25:55 +03:00
[GH-ISSUE #516] Unable to access user if white spaces are in username. #189
Labels
No labels
backend
blocked
bug
cleanup
dependencies
docker
documentation
duplicate
enhancement
enhancement
frontend
github_actions
good first issue
help wanted
help wanted
integration
invalid
ldap
pull-request
question
rust
rust
tests
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/lldap-lldap#189
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Normanras on GitHub (Mar 31, 2023).
Original GitHub issue: https://github.com/lldap/lldap/issues/516
The
CreateUserModeldoesn't explicitly require the use or non-use of white spaces in a username. I believe this function is for creating the user.However, after the user is created, if you try to click on the user to change other values, I get this error:
Error: Error getting user details: Errors: [user:2:3: Entity not found: 'test%20user%20with%20spaces']I've attached screenshots of the three steps to recreate:
usernamefield.I'm happy to open a PR for this fix, but I think @nitnelave and any other core devs need to make a decision on whitespaces in username. This may be related to issue #239 .
The possible options I'm thinking of:
validateorassertthat theString.contains(char::is_whitespace));and throw an errorreplace()& remove the whitespacesMy assumption with a username is that whitespaces should not be allowed as I've yet to see a unique username with a whitespace.
Screenshots. First, add the user:

Second, click save and verify the user is on the dashboard:

Third, click on the user:

@nitnelave commented on GitHub (Mar 31, 2023):
Yep, definitely needs more restrictions on the username.
@pixelrazor commented on GitHub (Mar 31, 2023):
I agree re: restrictions. As far as the actual bug here, i think the frontend is doing some escaping of the spaces which is causing it to not work as intended. I'd imagine spaces SHOULD work just fine, but i wouldn't be surprised if thre's actual issues beyond the escaping of the chars in the frontend
@Normanras commented on GitHub (Mar 31, 2023):
I'm happy to let you guys point me where to start. I can add to the validator, forcing the user to remove the whitespaces.
Given that all my other usernames without whitespaces don't throw the error, that could cover it for the time being.
@pixelrazor commented on GitHub (Apr 1, 2023):
If you want to tackle it:
The form lib uses this to validate https://github.com/Keats/validator
It should just be a simple addition to the user_details_form. The form struct should already have a validator on email iirc. You can probably validate with does_not_contain
@nitnelave commented on GitHub (Apr 10, 2023):
I fixed the underlying encoding issue, but we still need the username validation. Let's do that as part of #239 though.