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

Cannot login using Email #8021

Open
2 tasks done
rragundez opened this issue Jun 13, 2024 · 1 comment
Open
2 tasks done

Cannot login using Email #8021

rragundez opened this issue Jun 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rragundez
Copy link

rragundez commented Jun 13, 2024

Actions before raising this issue

  • I searched the existing issues and did not find anything similar.
  • I read/searched the docs

Steps to Reproduce

  1. Do the LDAP integration according to https://docs.cvat.ai/docs/administration/advanced/ldap/#update-docker-composeoverrideyml
  2. Login using a username known to be in the LDAP and verify that it works
  3. log out
  4. try to log in with the email

Expected Behavior

To be able to login with the email

Possible Solution

I tried to create a child of LDAPBackend, and overriding the authenticate method by just printing the input, this with the intention of manipulating the login mechanism

from django_auth_ldap import backend

class LDAPEmailBackend(backend.LDAPBackend):
    def authenticate(self, request, **kwargs):
        print("\n\nLDAPEmailBackend authenticate")
        print(request.POST)
        print(request)
        print(kwargs)
        return super().authenticate(request, **kwargs)

then setting the line bellow in settings.py

AUTHENTICATION_BACKENDS = ["cvat.ldap_email_backend.LDAPEmailBackend"]

and adding the volume ./ldap_email_backend.py:/home/django/cvat/ldap_email_backend.py to docker-compose.override.yml

There is a quite strange behaviour, when using username I can see the printed output from the container (docker compose logs -f cvat_server), when using an email, it doesn't even hit the authenticate method, I don't see any printed output but the api returns 400 Bad Request.

But If you first create a user using the LDAP username, and then try to login with the corresponding email of that username, I see the printed output and see that in the kwargs the field email is passed, then it fails to login. The interesting thing is if I use any other email the authenticate method is not called, as if something else is preventing it from hitting the authenticate method.

Context

No response

Environment

Tag v2.14.2

@rragundez rragundez added the bug Something isn't working label Jun 13, 2024
@rragundez
Copy link
Author

If you guide me to what is happening, I can happily submit a PR here and in django ldap auth to make this an out-of-the box feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant