Skip to content

Commit

Permalink
Merge pull request #272 from DigiThinkIT/staging
Browse files Browse the repository at this point in the history
Merge staging into production
  • Loading branch information
sahil28297 committed Oct 7, 2020
2 parents 36aa226 + 2e1919f commit fc40b78
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"reference_docname",
"section_break_7",
"url",
"endpoint",
"data",
"output",
"error"
Expand Down Expand Up @@ -94,10 +95,16 @@
"fieldtype": "Code",
"label": "URL",
"read_only": 1
},
{
"fieldname": "endpoint",
"fieldtype": "Data",
"label": "Endpoint",
"read_only": 1
}
],
"in_create": 1,
"modified": "2020-08-14 05:20:28.371522",
"modified": "2020-10-06 17:43:44.854237",
"modified_by": "Administrator",
"module": "Integrations",
"name": "Integration Request",
Expand Down
3 changes: 1 addition & 2 deletions frappe/integrations/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def authorize(*args, **kwargs):
params = get_urlparams_from_kwargs(kwargs)
request_url = urlparse(frappe.request.url)
success_url = request_url.scheme + "://" + request_url.netloc + "/api/method/frappe.integrations.oauth2.approve?" + params
failure_url = frappe.form_dict["redirect_uri"] + "?error=access_denied"

failure_url = (frappe.form_dict["redirect_uri"] or frappe.form_dict["cmd"] or "") + "?error=access_denied"
if frappe.session['user']=='Guest':
#Force login, redirect to preauth again.
frappe.local.response["type"] = "redirect"
Expand Down
7 changes: 6 additions & 1 deletion frappe/integrations/oauth2_logins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe.utils.oauth import login_via_oauth2, login_via_oauth2_id_token
from frappe.utils.oauth import get_oauth2_authorize_url, login_via_oauth2, login_via_oauth2_id_token
import json

@frappe.whitelist(allow_guest=True)
Expand Down Expand Up @@ -35,6 +35,11 @@ def login_via_salesforce(code, state):
def login_via_fairlogin(code, state):
login_via_oauth2("fairlogin", code, state, decoder=decoder_compat)

@frappe.whitelist(allow_guest=True)
def get_login_url(redirect_to=None, social_login_key_name="bloomstack"):
redirect_to = redirect_to.replace("&", "&")
return get_oauth2_authorize_url(social_login_key_name, redirect_to)

@frappe.whitelist(allow_guest=True)
def custom(code, state):
"""
Expand Down
2 changes: 1 addition & 1 deletion frappe/utils/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def update_oauth_user(user, data, provider):
user = frappe.new_doc("User")
user.update({
"doctype":"User",
"first_name": get_first_name(data),
"first_name": get_first_name(data) or get_email(data),
"last_name": get_last_name(data),
"email": get_email(data),
"gender": (data.get("gender") or "").title(),
Expand Down

0 comments on commit fc40b78

Please sign in to comment.