mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
FIX: store registration ip address when creating user via SSO (#26121)
This commit is contained in:
parent
2211ffa851
commit
1bd803d360
|
@ -256,6 +256,7 @@ class DiscourseConnect < DiscourseConnectBase
|
|||
name: resolve_name,
|
||||
username: resolve_username,
|
||||
ip_address: ip_address,
|
||||
registration_ip_address: ip_address,
|
||||
}
|
||||
|
||||
if SiteSetting.allow_user_locale && locale && LocaleSiteSetting.valid_value?(locale)
|
||||
|
|
|
@ -694,6 +694,26 @@ RSpec.describe DiscourseConnect do
|
|||
expect(user.username).to eq short_username
|
||||
end
|
||||
|
||||
it "stores registration ip address if it's present" do
|
||||
sso = new_discourse_sso
|
||||
sso.external_id = "100"
|
||||
|
||||
sso.email = "mail@mail.com"
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
|
||||
expect(user.registration_ip_address).to eq ip_address
|
||||
end
|
||||
|
||||
it "does not store registration ip address if it's not present" do
|
||||
sso = new_discourse_sso
|
||||
sso.external_id = "100"
|
||||
|
||||
sso.email = "mail@mail.com"
|
||||
user = sso.lookup_or_create_user(nil)
|
||||
|
||||
expect(user.registration_ip_address).to eq nil
|
||||
end
|
||||
|
||||
it "can fill in data on way back" do
|
||||
sso = make_sso
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user