FIX: Extra comma resulted in Github auth email result being an array.

https://meta.discourse.org/t/github-2fa-flow-broken/88674
This commit is contained in:
Guo Xiang Tan
2018-05-30 11:54:12 +08:00
parent 00b6f5f21c
commit 543b7cddfb
2 changed files with 12 additions and 5 deletions

View File

@ -24,9 +24,8 @@ describe Auth::GithubAuthenticator do
let(:user) { Fabricate(:user) }
context 'after_authenticate' do
it 'can authenticate and create a user record for already existing users' do
hash = {
let(:data) do
{
extra: {
all_emails: [{
email: user.email,
@ -41,14 +40,22 @@ describe Auth::GithubAuthenticator do
},
uid: "100"
}
end
result = authenticator.after_authenticate(hash)
it 'can authenticate and create a user record for already existing users' do
result = authenticator.after_authenticate(data)
expect(result.user.id).to eq(user.id)
expect(result.username).to eq(user.username)
expect(result.name).to eq(user.name)
expect(result.email).to eq(user.email)
expect(result.email_valid).to eq(true)
# Authenticates again when user has Github user info
result = authenticator.after_authenticate(data)
expect(result.email).to eq(user.email)
expect(result.email_valid).to eq(true)
end
it 'should use primary email for new user creation over other available emails' do