Skip to content

Commit

Permalink
🪓 Fixes Auth0 login (#140)
Browse files Browse the repository at this point in the history
Fixes Auth0 login process
  • Loading branch information
mrharpo authored Dec 13, 2023
1 parent 8484c60 commit a6c7518
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions ov_wag/templates/wagtailadmin/login.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@

{% extends "wagtailadmin/login.html" %}
{% load custom_tags %}
{% load i18n %}
{% load allauth %}
{% load socialaccount %}

{% block css %}
{{ block.super }}
<meta name="google-signin-client_id" content="{% get_setting 'GOOGLE_CLIENT_ID' %}">
<style>
.auth0-login {
width: 100%;
height: 3em;
}
</style>
{% endblock %}

{% load socialaccount %}

{% block above_login %}
<a href="{% provider_login_url 'auth0' next=callback_url process='login' %}">Sign in with Google</a>

<div id="my-signin2"></div>
<script>
function onSuccess(googleUser) {
console.log('Logged in as: ' + googleUser.getBasicProfile().getName());
}
function onFailure(error) {
console.log(error);
}
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'profile email',
'width': 240,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
</script>

<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
{% element form action="/accounts/auth0/login/?process=login" method="post" no_visible_fields=True %}
{% slot actions %}
{% csrf_token %}
<button type="submit" class="auth0-login">Sign in with Auth0</button>
{% endslot %}
{% endelement %}
<br>
{% endblock %}

0 comments on commit a6c7518

Please sign in to comment.