GithubHelp home page GithubHelp logo

Comments (4)

hamishmorgan avatar hamishmorgan commented on July 28, 2024

Thanks for raising this issue @jgongil

Usernames are supposed to be case-insensitive in the platform so generally it shouldn't matter. The problem is in this project we are lowercasing it, but then comparing to the original case. The solution is to ensure comparisons are case-insensitive. Specifically here:

elif user["username"] == username:

If you've got time to PR a fix I'll be happy to merge it. Otherwise I'll ask someone to take a look soon.

from api_sdk.

jgongil avatar jgongil commented on July 28, 2024

Many thanks for your help @hamishmorgan
I got around it by changing the comparison in _test_auth(self, username, token) as below, but at the same time I had to force/ensure that the BWUser is created with username in lower case.

def _test_auth(self, username, token): ... elif user["username"].lower() == username: #JG[20180904]: JSON can contain username in capital letters

from api_sdk.

hamishmorgan avatar hamishmorgan commented on July 28, 2024

Why not lower-cased both sides?

elif user["username"].lower() == username.lower()

That way people can use whatever case they like, and it just ignores it during comparison.

from api_sdk.

jgongil avatar jgongil commented on July 28, 2024

Hi, yes we can, but that requires not only changing _test_auth but also:
_read_auth which is also doing if username in user_tokens (mixed case vs lower case)

from api_sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.