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:
parent
4d43158fe2
commit
3f90b0be69
@ -43,7 +43,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||||||
|
|
||||||
resource.locale = I18n.locale
|
resource.locale = I18n.locale
|
||||||
resource.agreement = true
|
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?
|
resource.build_account if resource.account.nil?
|
||||||
end
|
end
|
||||||
@ -132,7 +132,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||||||
"serverKey" => ENV.fetch('GAB_CAPTCHA_SECRET_KEY', ''),
|
"serverKey" => ENV.fetch('GAB_CAPTCHA_SECRET_KEY', ''),
|
||||||
"value" => typedChallenge,
|
"value" => typedChallenge,
|
||||||
"username" => username,
|
"username" => username,
|
||||||
"ip" => request.headers['True-Client-IP']
|
"ip" => request.headers['True-Client-IP'] || request.remote_ip
|
||||||
}).perform do |res|
|
}).perform do |res|
|
||||||
body = JSON.parse(res.body_with_limit)
|
body = JSON.parse(res.body_with_limit)
|
||||||
result = !!body["success"]
|
result = !!body["success"]
|
||||||
|
@ -169,7 +169,8 @@ class User < ApplicationRecord
|
|||||||
self.last_sign_in_at = old_current || new_current
|
self.last_sign_in_at = old_current || new_current
|
||||||
self.current_sign_in_at = 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.last_sign_in_ip = old_current || new_current
|
||||||
self.current_sign_in_ip = new_current
|
self.current_sign_in_ip = new_current
|
||||||
|
|
||||||
@ -233,7 +234,7 @@ class User < ApplicationRecord
|
|||||||
def activate_session(request)
|
def activate_session(request)
|
||||||
session_activations.activate(session_id: SecureRandom.hex,
|
session_activations.activate(session_id: SecureRandom.hex,
|
||||||
user_agent: request.user_agent,
|
user_agent: request.user_agent,
|
||||||
ip: request.remote_ip).session_id
|
ip: request.headers['True-Client-IP'] || request.remote_ip).session_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def exclusive_session(id)
|
def exclusive_session(id)
|
||||||
|
Loading…
Reference in New Issue
Block a user