fix(integrations): fix base url for openid_profile

if the server is behind proxy the frappe.request.url scheme
is http instead of https causing mixed content errors in browser
This commit is contained in:
Revant Nandgaonkar 2021-02-24 12:31:34 +05:30
parent 108fb84767
commit 3d26f84d33

View file

@ -163,10 +163,13 @@ def openid_profile(*args, **kwargs):
first_name, last_name, avatar, name = frappe.db.get_value("User", frappe.session.user, ["first_name", "last_name", "user_image", "name"])
frappe_userid = frappe.db.get_value("User Social Login", {"parent":frappe.session.user, "provider": "frappe"}, "userid")
request_url = urlparse(frappe.request.url)
base_url = frappe.db.get_value("Social Login Key", "frappe", "base_url") or None
if avatar:
if validate_url(avatar):
picture = avatar
elif base_url:
picture = base_url + '/' + avatar
else:
picture = request_url.scheme + "://" + request_url.netloc + avatar