WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.52k stars 1k forks source link

would like to invite new users to register and login into Weblate only using their GITHUB #11850

Closed spurnasai closed 2 months ago

spurnasai commented 3 months ago

Describe the issue

I have to limit my users to only login only via GITHUB credentials . So I want to disable the Register new account from my UI login page . I have used WEBLATE_REGISTRATION_OPEN: 0 and 1 WEBLATE_REGISTRATION_ALLOW_BACKENDS: github-oauth2 as my env variables and I have used both 0 and 1 for the WEBLATE_REGISTRATION_OPEN in both the cases it was not allowing the new users to register

I already tried

Steps to reproduce the behavior

  1. I have gone through https://docs.weblate.org/en/latest/admin/config.html#std-setting-REGISTRATION_ALLOW_BACKENDS and https://docs.weblate.org/en/latest/admin/config.html#std-setting-REGISTRATION_OPEN
  2. If I remove both of those env variables then it is allowing the new users to login through new registration and GITHUB

Expected behavior

So my expectation is that I want my users to only login by github authentication I want to disable the new register option from my UI.

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

Docker container

Weblate versions

5.5.5

Weblate deploy checks

No response

Additional context

No response

spurnasai commented 3 months ago

I have used # Weblate setup

WEBLATE_REGISTRATION_OPEN=1 WEBLATE_REGISTRATION_ALLOW_BACKENDS: ["social_core.backends.github.GithubOAuth2"] WEBLATE_REQUIRE_LOGIN: 1
![Uploading Screenshot 2024-06-13 234744.png…]() Screenshot 2024-06-13 234802 Screenshot 2024-06-13 234904
![Screenshot 2024-06-13 234949](https://github.com/WeblateOrg/weblate/assets/167166915/c6f5082e-d8e6-40a2-81cb-9daf686b7686)

github-actions[bot] commented 3 months ago

This issue has been marked as a question by a Weblate team member. Why? Because it belongs more to the professional Weblate Care or community Discussions than here. We strive to answer these reasonably fast here, too, but purchasing the support subscription is more responsible and faster for your business. And it makes Weblate stronger as well. Thanks!

In case your question is already answered, making a donation is the right way to say thank you!

nijel commented 3 months ago

Your value for WEBLATE_REGISTRATION_ALLOW_BACKENDS is wrong, the documentation says:

The backend names match names used in the URL for authentication.

So you should use github instead of social_core.backends.github.GithubOAuth2.

Why posting same question twice? https://github.com/WeblateOrg/weblate/discussions/11849

spurnasai commented 3 months ago

Hi @nijel , I have replaced "social_core.backends.github.GithubOAuth2" with "github" and also tried using "github-oauth2" but still getting the same problem "New registrations are turned off". If I am not using this "WEBLATE_REGISTRATION_ALLOW_BACKENDS" then both new registrations and github authentication are working fine . But I want my users to login only via GITHUB not through "New account registration"

nijel commented 3 months ago

Are the settings actually applied? How does your docker-compose.yml look like?

spurnasai commented 3 months ago

settings.py.txt docker-compose-https.override.yml.txt docker-compose-https.yml.txt These are the files I am using , WEBLATE_REGISTRATION_OPEN: 1 is in environment file

nijel commented 3 months ago

As these are not default Docker compose names, you need to pass the override as -f docker-compose-https.override.yml.txt on the command line.

spurnasai commented 3 months ago

I have run
'docker compose -f docker-compose-https.yml -f docker-compose-https.override.yml build' 'docker compose -f docker-compose-https.yml -f docker-compose-https.override.yml up' on my command line

spurnasai commented 3 months ago

docker-compose-https.override.yml.txt there is any problem with the configuration files or command I have used. This is the docker-compose-https.override.yml I am using

nijel commented 3 months ago

The environment variables are string, so it should be:

WEBLATE_REGISTRATION_ALLOW_BACKENDS: "github"
github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because there wasn’t any recent activity.

It will be closed soon if no further action occurs.

Thank you for your contributions!