-
-
Notifications
You must be signed in to change notification settings - Fork 486
Add case sensitivity parameter to getAccount #230
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
Conversation
Note for reviewer: Account names are case-sensitive by default, but addAccount supports case-insensitivity. |
If there are two accounts 'bob' and 'BOB', and bob is first in the account database, then getAccount("BOB", nil, true) will return the account for 'bob' |
No it won't. If you set the third argument to false (case insensitive) then it will return the first match however. Since this is not the default behavior, I think it would be acceptable if a warning in the wiki is added. Returning a table of accounts would make the function much slower so I chose to just return the first result. |
I just looked into it again and noticed that it generates a an array anyway so it wouldn't make it slower. Should I make it return a table when caseSensitive is set to false? |
What about doing a case sensitive search first? If that returns no results then do a case insensitive search |
If there is no case sensitive match, should it return the first case insensitive match or all case insensitive matches? |
but you can have |
I think returning a table would be inconsistent. Maybe there should be another function for this or an updated getAccounts function that could take a username argument and find all accounts with different case variations. |
Something like |
@Citizen01 it wouldn't break any scripts since no scripts use a third argument yet. What I mean is the function name itself screams one account, singular. |
What do devs think?
|
|
4. Leave it as it is (returns exact match and if there is no exact match then the first case-insensitive match) Plus the password should be checked during the search as well |
Just to rewind a bit, when would this feature be used by scripters? |
One use would be to make login panels ignore case, thus reducing the chance of people forgetting their credentials. |
If |
@qaisjp yes, this was to address servers that use case variations for their account usernames. |
I see. So you do want to disable the ability to accept case insensitive names because you (e.g) have accounts |
No, it is already like that. I want to add an ability to accept case insensitive usernames. If the login panel example is too confusing, consider this: you want to add a real-time username availability checking (as user types their username). If there is an account called "JAMES" and user types in "James", getAccount("James") will return false and the script will say that the username is available even though it isn't since case variation is not allowed by that server. By using the feature from this PR you can check whether any case variation of "james" exists and thus return the correct result. |
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.
Please address @botder's review, otherwise, looks good.
No description provided.