-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/sso' of github.com:torchbox/rca-wagtail-2019 in…
…to dev
- Loading branch information
Showing
10 changed files
with
1,436 additions
and
1,003 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
80 changes: 80 additions & 0 deletions
80
rca/project_styleguide/templates/patterns/pages/auth/login.html
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{% extends "wagtailadmin/admin_base.html" %} | ||
{% load i18n wagtailadmin_tags %} | ||
{% block titletag %}{% trans "Sign in" %}{% endblock %} | ||
{% block bodyclass %}login{% endblock %} | ||
|
||
{% block furniture %} | ||
<main class="content-wrapper" id="main"> | ||
<h1>{% block branding_login %}{% trans "Sign in to Wagtail" %}{% endblock %}</h1> | ||
|
||
<div class="messages" role="status"> | ||
{# Always show messages div so it can be appended to by JS #} | ||
{% if messages or form.errors %} | ||
<ul> | ||
{% if form.errors %} | ||
{% for error in form.non_field_errors %} | ||
<li class="error">{{ error }}</li> | ||
{% endfor %} | ||
{% endif %} | ||
{% for message in messages %} | ||
<li class="{{ message.tags }}">{{ message }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
</div> | ||
|
||
{% block above_login %}{% endblock %} | ||
|
||
<form class="login-form" action="{% url 'wagtailadmin_login' %}" method="post" autocomplete="off" novalidate> | ||
{% block login_form %} | ||
{% csrf_token %} | ||
|
||
{% url 'wagtailadmin_home' as home_url %} | ||
<input type="hidden" name="next" value="{{ next|default:home_url }}" /> | ||
|
||
{% block fields %} | ||
{% formattedfield form.username %} | ||
{% formattedfield form.password %} | ||
|
||
{% if show_password_reset %} | ||
<a class="reset-password" href="{% url 'wagtailadmin_password_reset' %}">{% trans "Forgotten password?" %}</a> | ||
{% endif %} | ||
|
||
{% block extra_fields %} | ||
{% for field_name, field in form.extra_fields %} | ||
{% formattedfield field %} | ||
{% endfor %} | ||
{% endblock extra_fields %} | ||
|
||
{% include "wagtailadmin/shared/forms/single_checkbox.html" with label_classname="remember-me" name="remember" text=_("Remember me") %} | ||
{% endblock %} | ||
{% endblock %} | ||
<footer class="form-actions"> | ||
{% block submit_buttons %} | ||
<button | ||
type="submit" | ||
class="button button-longrunning" | ||
data-controller="w-progress" | ||
data-action="w-progress#activate" | ||
data-w-progress-active-value="{% trans 'Signing in…' %}" | ||
> | ||
{% icon name="spinner" %} | ||
<em data-w-progress-target="label">{% trans 'Sign in' %}</em> | ||
</button> | ||
<br /><br /> | ||
<a class="button" href="{% url "social:begin" "azuread-tenant-oauth2" %}?next={{ request.path }}"> | ||
Sign in with single sign-on | ||
</a> | ||
{% endblock %} | ||
</footer> | ||
</form> | ||
|
||
{% block below_login %}{% endblock %} | ||
|
||
{% block branding_logo %} | ||
<div class="login-logo"> | ||
{% include "wagtailadmin/logo.html" with wordmark="True" %} | ||
</div> | ||
{% endblock %} | ||
</main> | ||
{% endblock %} |
38 changes: 38 additions & 0 deletions
38
rca/project_styleguide/templates/patterns/pages/auth/logout_confirmation.html
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% extends "wagtailadmin/admin_base.html" %} | ||
{% load i18n wagtailadmin_tags %} | ||
{% block titletag %}{% trans "Log out" %}{% endblock %} | ||
{% block bodyclass %}login{% endblock %} | ||
|
||
{% block furniture %} | ||
<main class="content-wrapper" id="main"> | ||
<h1>{% block branding_login %}{% trans "Logout from Wagtail" %}{% endblock %}</h1> | ||
|
||
<form class="login-form" action="{% url 'sso_logout_confirmation' %}" method="post" novalidate> | ||
{% block login_form %} | ||
{% csrf_token %} | ||
|
||
<div class="messages"> | ||
<p> | ||
You have signed in using Single Sign-On (SSO). Logging out here will only end your session for this application. To completely sign out, make sure to log out from your SSO provider as well. | ||
</p> | ||
</div> | ||
|
||
<button type="submit" class="button button-longrunning"> | ||
{% trans 'Log out' %} | ||
</button> | ||
|
||
<br /><br /> | ||
|
||
<button type="button" class="button" onclick="window.history.back();"> | ||
{% trans 'Cancel' %} | ||
</button> | ||
{% endblock %} | ||
</form> | ||
|
||
{% block branding_logo %} | ||
<div class="login-logo"> | ||
{% include "wagtailadmin/logo.html" with wordmark="True" %} | ||
</div> | ||
{% endblock %} | ||
</main> | ||
{% endblock %} |
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
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.contrib.auth.models import Group | ||
|
||
|
||
def make_sso_users_editors(backend, user, response, *args, **kwargs): | ||
editors = Group.objects.get(name="Editors") | ||
user.groups.add(editors) |