Merge pull request #21706 from shariquerik/oauth-confirm-screen

This commit is contained in:
Shariq Ansari 2023-07-20 12:22:07 +05:30 committed by GitHub
commit a34d87d440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View file

@ -101,6 +101,10 @@ def authorize(**kwargs):
frappe.local.response["type"] = "redirect"
frappe.local.response["location"] = success_url
else:
if "openid" in scopes:
scopes.remove("openid")
scopes.extend(["First Name", "Last Name", "Email", "Password", "User Image", "Roles"])
# Show Allow/Deny screen.
response_html_params = frappe._dict(
{
@ -113,7 +117,7 @@ def authorize(**kwargs):
resp_html = frappe.render_template(
"templates/includes/oauth_confirmation.html", response_html_params
)
frappe.respond_as_web_page("Confirm Access", resp_html)
frappe.respond_as_web_page("Confirm Access", resp_html, primary_action=None)
except (FatalClientError, OAuth2Error) as e:
return generate_json_error_response(e)

View file

@ -1,22 +1,19 @@
{% if not error %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{ _("{} wants to access the following details from your account").format(client_id) }}</h3>
<div class="panel-title h3">{{ _(client_id) }}</div>
<p class="panel-subtitle">{{ _("wants to access the following details from your account") }}</p>
</div>
<div class="panel-body">
<ul class="list-group">
<ul>
{% for dtl in details %}
<li class="list-group-item">{{ dtl.title() }}</li>
<li>{{ dtl.title() }}</li>
{% endfor %}
</ul>
<ul class="list-inline">
<li>
<button id="allow" class="btn btn-sm btn-primary">{{ _("Allow") }}</button>
</li>
<li>
<button id="deny" class="btn btn-sm btn-light">{{ _("Deny") }}</button>
</li>
</ul>
<div class="action-buttons d-flex">
<button id="deny" class="btn btn-sm btn-light btn-block mr-3">{{ _("Deny") }}</button>
<button id="allow" class="btn btn-sm btn-primary btn-block">{{ _("Allow") }}</button>
</div>
</div>
</div>
<script type="text/javascript">