Reduce clicks on google login

This commit is contained in:
2026-05-15 00:52:26 +03:00
parent 526fec314d
commit 24624cc4d1

View File

@@ -14,13 +14,11 @@
</p> </p>
</div> </div>
{% comment %} {# POST (not GET) so allauth's LoginView skips its intermediate confirm page and 302s straight to Google. #}
The button is a GET to allauth's google_login view -- not a POST form -- <form method="post" action="{% url 'google_login' %}">
because the actual OAuth handshake happens via a 302 redirect to Google. {% csrf_token %}
The `?next=` from `/accounts/login/?next=/wherever/` is forwarded so the {% if request.GET.next %}<input type="hidden" name="next" value="{{ request.GET.next }}">{% endif %}
user lands back on the page they were trying to reach. <button type="submit"
{% endcomment %}
<a href="{% url 'google_login' %}{% if request.GET.next %}?next={{ request.GET.next|urlencode }}{% endif %}"
class="flex items-center justify-center gap-3 w-full px-4 py-3 rounded-md border border-slate-300 bg-white hover:bg-slate-50 text-slate-900 font-medium shadow-sm"> class="flex items-center justify-center gap-3 w-full px-4 py-3 rounded-md border border-slate-300 bg-white hover:bg-slate-50 text-slate-900 font-medium shadow-sm">
<svg class="w-5 h-5" viewBox="0 0 24 24" aria-hidden="true"> <svg class="w-5 h-5" viewBox="0 0 24 24" aria-hidden="true">
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.75h3.57c2.08-1.92 3.28-4.74 3.28-8.07z"/> <path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.75h3.57c2.08-1.92 3.28-4.74 3.28-8.07z"/>
@@ -29,7 +27,8 @@
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.04l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38z"/> <path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.04l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38z"/>
</svg> </svg>
Continue with Google Continue with Google
</a> </button>
</form>
<div class="mt-6 text-center"> <div class="mt-6 text-center">
<a href="{% url 'submissions:create' %}" class="text-sm text-slate-600 hover:underline">No thanks, just submit as a guest →</a> <a href="{% url 'submissions:create' %}" class="text-sm text-slate-600 hover:underline">No thanks, just submit as a guest →</a>