在我的組織中,某些用戶沒有電子郵件地址。在ActiveDirectory的電子郵件字段中,他們有一個假的(格式錯誤的)電子郵件地址,如「[email protected]」。沒有電子郵件的Gitlab登錄LDAP用戶
當這些用戶試圖登錄到Gitlab,他們收到以下錯誤:
「無法從LDAP授權你,是因爲‘驗證失敗:郵件無效,電子郵件是無效的’。」
是否有任何配置忽略使用LDAP的電子郵件地址檢查?
在我的組織中,某些用戶沒有電子郵件地址。在ActiveDirectory的電子郵件字段中,他們有一個假的(格式錯誤的)電子郵件地址,如「[email protected]」。沒有電子郵件的Gitlab登錄LDAP用戶
當這些用戶試圖登錄到Gitlab,他們收到以下錯誤:
「無法從LDAP授權你,是因爲‘驗證失敗:郵件無效,電子郵件是無效的’。」
是否有任何配置忽略使用LDAP的電子郵件地址檢查?
的issue 6230一直在跟蹤這一點:
The mail validation on user model is performed by validation here:
app/models/user.rb
.I think you can configure your own regexp here:
config/initializers/devise.rb
.
然而,官方的說法是:
Disabling validation is not something that will be done on GitLab side. This can lead to inconsistencies in the database and could cause a plethora of issues.
I suggest you :
allow_username_or_email_login
設置: https://github.com/gitlabhq/gitlabhq/blob/master/config/gitlab.yml.example#L130This is issue is a support question so I will point you to the contributing guide and close it.
不直接與GitLab本身,因爲該錯誤消息是omniauth
回調的結果是:看config/locales/devise.en.yml
:
omniauth_callbacks:
success: 'Successfully authorized from %{kind} account.'
failure: 'Could not authorize you from %{kind} because "%{reason}".'
然而,Rodrigo Carvalho報告in the comments:
I actually discovered this is a Gitlab behaviour.
I changed the "
/lib/gitlab/oauth/user.rb
" (Gitlab code) to append a ".com
" in the end of the invalid email address and it worked.
好的,謝謝你的回答。我發佈到omniauth人:http://stackoverflow.com/questions/21462163/omniauth-ldap-logon-user-without-e-mail –
我實際上發現這是一個Gitlab的行爲。我更改了「/lib/gitlab/oauth/user.rb」(Gitlab代碼)以在無效電子郵件地址的末尾附加「.com」,並且它工作正常。我應該在Github上打開一張票嗎? –
@RodrigoCarvalho聽起來不錯!我已經將你的發現納入了更多可見性的答案中,並且鏈接到了'user.rb'源代碼。這對於拉取請求確實是一個很好的候選者,或者至少是GitLab查看它的一個問題。 – VonC