Updated all instances of request.remote_ip to use new ip headers

• Updated:
- all instances of request.remote_ip to use new ip headers
This commit is contained in:
Developer 2021-02-26 12:50:25 -05:00
parent 4d43158fe2
commit 3f90b0be69
2 changed files with 5 additions and 4 deletions

View File

@ -43,7 +43,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
resource.locale = I18n.locale
resource.agreement = true
resource.current_sign_in_ip = request.remote_ip
resource.current_sign_in_ip = request.headers['True-Client-IP'] || request.remote_ip
resource.build_account if resource.account.nil?
end
@ -132,7 +132,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
"serverKey" => ENV.fetch('GAB_CAPTCHA_SECRET_KEY', ''),
"value" => typedChallenge,
"username" => username,
"ip" => request.headers['True-Client-IP']
"ip" => request.headers['True-Client-IP'] || request.remote_ip
}).perform do |res|
body = JSON.parse(res.body_with_limit)
result = !!body["success"]

View File

@ -169,7 +169,8 @@ class User < ApplicationRecord
self.last_sign_in_at = old_current || new_current
self.current_sign_in_at = new_current
old_current, new_current = current_sign_in_ip, request.remote_ip
old_current = current_sign_in_ip
new_current = request.headers['True-Client-IP'] || request.remote_ip
self.last_sign_in_ip = old_current || new_current
self.current_sign_in_ip = new_current
@ -233,7 +234,7 @@ class User < ApplicationRecord
def activate_session(request)
session_activations.activate(session_id: SecureRandom.hex,
user_agent: request.user_agent,
ip: request.remote_ip).session_id
ip: request.headers['True-Client-IP'] || request.remote_ip).session_id
end
def exclusive_session(id)