Skip to content

Commit

Permalink
fix: don't show social login icon if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
prssanna committed Mar 10, 2021
1 parent aa8f7cc commit 91cb71f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion frappe/www/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ <h4>{{ _("Javascript is disabled on your browser") }}</h4>
<div class="login-button-wrapper">
<a href="{{ provider.auth_url }}"
class="btn btn-block btn-default btn-sm btn-login-option btn-{{ provider.name }}">
{{ provider.icon }} {{ _("Login With") }} {{ provider.provider_name }}</a>
{% if provider.icon %}
{{ provider.icon }}
{% endif %}
{{ _("Login With") }} {{ provider.provider_name }}</a>
</div>
{% endfor %}
<p class="text-muted login-divider">{{ _("or") }}</p>
Expand Down
14 changes: 8 additions & 6 deletions frappe/www/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_context(context):
redirect_to = get_home_page()
else:
redirect_to = "/app"

if redirect_to != 'login':
frappe.local.flags.redirect_location = redirect_to
raise frappe.Redirect
Expand All @@ -44,11 +44,13 @@ def get_context(context):
client_secret = get_decrypted_password("Social Login Key", provider, "client_secret")
provider_name = frappe.get_value("Social Login Key", provider, "provider_name")

if provider_name != "Custom":
icon_url = frappe.get_value("Social Login Key", provider, "icon")
icon = "<img src='{0}' alt={1}>".format(icon_url, provider_name)
else:
icon = get_icon_html(frappe.get_value("Social Login Key", provider, "icon"), small=True)
icon = None
icon_url = frappe.get_value("Social Login Key", provider, "icon")
if icon_url:
if provider_name != "Custom":
icon = "<img src='{0}' alt={1}>".format(icon_url, provider_name)
else:
icon = get_icon_html(icon_url, small=True)

if (get_oauth_keys(provider) and client_secret and client_id and base_url):
context.provider_logins.append({
Expand Down

0 comments on commit 91cb71f

Please sign in to comment.