mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: save registration_ip_address for staged users logging in via social auth
This commit is contained in:
parent
e2b64257b3
commit
492af81e67
2 changed files with 21 additions and 0 deletions
|
@ -89,6 +89,26 @@ RSpec.describe Users::OmniauthCallbacksController do
|
|||
expect(user.email_confirmed?).to eq(true)
|
||||
end
|
||||
|
||||
it "should activate/unstage staged user" do
|
||||
user.update!(staged: true, registration_ip_address: nil)
|
||||
|
||||
user.reload
|
||||
expect(user.staged).to eq(true)
|
||||
expect(user.registration_ip_address).to eq(nil)
|
||||
|
||||
events = DiscourseEvent.track_events do
|
||||
get "/auth/google_oauth2/callback.json"
|
||||
end
|
||||
|
||||
expect(events.map { |event| event[:event_name] }).to include(:user_logged_in, :user_first_logged_in)
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
user.reload
|
||||
expect(user.staged).to eq(false)
|
||||
expect(user.registration_ip_address).to be_present
|
||||
end
|
||||
|
||||
context 'when user has not verified his email' do
|
||||
before do
|
||||
GoogleUserInfo.create!(google_user_id: '12345', user: user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue