-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Auth0 login process
- Loading branch information
Showing
1 changed file
with
16 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |