Skip to content

Override generate_temporarily_email method

Baodong请求将override/generate_temporarily_email合并到main-jh

Related issue: #2840 (closed)

What does this MR do and why?

To reduce exception of Net::SMTPSyntaxError: https://jihulab.sentry.io/issues/3289637725/?project=5717033&referrer=alerts-related-issues-issue-stream

When user sign up from oauth like Google/DingTalk without a email, GitLab will give user a default fake email address:

"temp-email-for-oauth-#{username}@gitlab.localhost"

There are two hidden dangers here:

  • username is likely to be a duplicate
  • If the username is in Chinese, the SMTP service probably does not support. (Like those alarms mentioned in the issue)

Using non-repeating uuids instead of username strings solves these problems.

Screenshots or screen recordings

sign up failed for exists email:

截屏2023-04-17_17.15.47

How to set up and validate locally

Add a provider to omniauth:

config/gitlab.yml

omniauth:
    enabled: true
    auto_sign_in_with_provider:
    # sync_profile_from_provider: []
    # sync_profile_attributes: true
    allow_single_sign_on: true
    block_auto_created_users: false
    auto_link_user: true
    auto_link_ldap_user: false
    auto_link_saml_user: false
    external_providers: []
    providers:
      - { name: 'dingtalk',
          app_id: '',
          app_secret: '' }

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Baodong 编辑于

合并请求报告

加载中