Skip to content

Commit 5b6922a

Browse files
committed
Story 2422: Sign In Webpage Integration
1 parent a2f0da2 commit 5b6922a

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

templates/v3/accounts/login.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
redirect_field_value (string, optional, default unset) — URL to redirect to after login; hidden input omitted when unset
1717
contributor_account_redirect_message (string, optional, default unset) — message for pre-created author/maintainer accounts; alert omitted when unset
1818
{% endcomment %}
19-
{% load static %}
19+
{% load static socialaccount %}
2020

2121
{% block auth_content %}
2222
<div class="auth-page__header">
@@ -28,7 +28,7 @@ <h1 class="auth-page__title">Login to your account</h1>
2828

2929
<form class="auth-page__card"
3030
method="post"
31-
action=""
31+
action="{% url 'account_login' %}"
3232
novalidate
3333
{# djlint:off #}
3434
x-data="{ hasErrors: false }"
@@ -70,8 +70,17 @@ <h1 class="auth-page__title">Login to your account</h1>
7070
<p class="auth-page__divider">OR</p>
7171

7272
<div class="auth-page__social-card">
73-
{% include "v3/includes/_button.html" with label="Continue with GitHub" url="#" icon_name="github" style="secondary" %}
74-
{% include "v3/includes/_button.html" with label="Continue with Google" url="#" icon_name="google-colored" style="secondary" %}
73+
{% get_providers as socialaccount_providers %}
74+
{% if socialaccount_providers %}
75+
{% for provider in socialaccount_providers %}
76+
{% provider_login_url provider process="login" scope=scope auth_params=auth_params as href %}
77+
{% if provider.name == "GitHub" %}
78+
{% include "v3/includes/_button.html" with label="Continue with "|add:provider.name url=href icon_name="github" style="secondary" %}
79+
{% elif provider.name == "Google" %}
80+
{% include "v3/includes/_button.html" with label="Continue with "|add:provider.name url=href icon_name="google-colored" style="secondary" %}
81+
{% endif %}
82+
{% endfor %}
83+
{% endif %}
7584
{% include "v3/includes/_button.html" with label="Don't have an account? Sign up →" url=signup_url style="primary" %}
7685
</div>
7786
{% endblock auth_content %}

users/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ def form_invalid(self, form):
578578
return res if res else super().form_invalid(form)
579579

580580

581-
class CustomLoginView(LoginView):
581+
class CustomLoginView(V3AuthContextMixin, LoginView):
582+
v3_template_name = "v3/accounts/login.html"
583+
582584
def get_context_data(self, **kwargs):
583585
context = super().get_context_data(**kwargs)
584586
context["contributor_account_redirect_message"] = self.request.session.pop(

0 commit comments

Comments
 (0)