WeblateOrg / weblate

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

Codeberg OAuth does not allow secondary e-mails to be used #12167

Open lucasmz-dev opened 1 month ago

lucasmz-dev commented 1 month ago

Describe the issue

When using Codeberg's Weblate which only uses their own authentication with Codeberg, I am not able to use any secondary e-mails set up in the account. I usually have an email used for my Git identity (git@lucasmz.dev), I usually set my commit e-mail on Hosted Weblate to it, unfortunately due to this issue, I am not able to do that on this type of instance, because only the main address is considered.

Switching the main e-mail on Codeberg to that one, and re-logging in their instance, makes it so that it is available, undoing it however, removes it again.

I already tried

Steps to reproduce the behavior

  1. Add a secondary email address to Codeberg
  2. Log in to Weblate
  3. Go to account settings
  4. No email found

Expected behavior

All email addresses associated with that account to be usable in Weblate.

Screenshots

image image

Exception traceback

No response

How do you run Weblate?

Other

Weblate versions

No response

Weblate deploy checks

No response

Additional context

This is not an issue with hosted.weblate.org and GitHub for instance, if I were to use that. Codeberg Translate does not allow the addition of other e-mail addresses into weblate directly.

nijel commented 1 month ago

Weblate has GitHub integration to fetch additional email addresses, something similar needs to be implemented here as well.

github-actions[bot] commented 1 month ago

This issue has been added to the backlog. It is not scheduled on the Weblate roadmap, but it eventually might be implemented.

In case you need this feature soon, please consider helping or push it by funding the development.

github-actions[bot] commented 1 month ago

This issue seems to be a good fit for newbie contributors. You are welcome to contribute to Weblate! Don't hesitate to ask any questions you would have while implementing this.

You can learn about how to get started in our contributors documentation.

Het4304 commented 5 days ago

I am interested in solving the issue

nijel commented 5 days ago

There are two possible approaches, depending on how Codeberg (Gitea API) exposes this:

  1. When exposed in /api/v1/user, it can be implemented in python-social-auth here: https://github.com/python-social-auth/social-core/blob/d9554fa40e751c85ae60231fe2f5bd5a528c4452/social_core/backends/gitea.py#L36-L51
  2. When there is a separate API call needed, it should be implemented in Weblate like we do for GitHub:

    https://github.com/WeblateOrg/weblate/blob/9a01e7d92c7bd1b37aedce381a072f3c003e3881/weblate/accounts/pipeline.py#L55-L87