mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-18 21:09:42 -05:00
feat: RBAC + SAML support
This commit is contained in:
14
templates/socialaccount/authentication_error.html
Normal file
14
templates/socialaccount/authentication_error.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends "socialaccount/base_entrance.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Third-Party Login Failure" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Third-Party Login Failure" %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% trans "An error occurred while attempting to login via your third-party account." %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
2
templates/socialaccount/base_entrance.html
Normal file
2
templates/socialaccount/base_entrance.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}{% endblock %}
|
||||
1
templates/socialaccount/base_manage.html
Normal file
1
templates/socialaccount/base_manage.html
Normal file
@@ -0,0 +1 @@
|
||||
{% extends "allauth/layouts/manage.html" %}
|
||||
54
templates/socialaccount/connections.html
Normal file
54
templates/socialaccount/connections.html
Normal file
@@ -0,0 +1,54 @@
|
||||
{% extends "socialaccount/base_manage.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Account Connections" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Account Connections" %}
|
||||
{% endelement %}
|
||||
{% if form.accounts %}
|
||||
{% element p %}
|
||||
{% blocktrans %}You can sign in to your account using any of the following third-party accounts:{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% url 'socialaccount_connections' as action_url %}
|
||||
{% element form form=form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% for acc in form.fields.account.choices %}
|
||||
{% with account=acc.0.instance.get_provider_account %}
|
||||
{% setvar radio_id %}
|
||||
id_account_{{ account.account.pk }}
|
||||
{% endsetvar %}
|
||||
{% setvar tags %}
|
||||
socialaccount,{{ account.account.provider }}
|
||||
{% endsetvar %}
|
||||
{% element field id=radio_id type="radio" name="account" value=account.account.pk %}
|
||||
{% slot label %}
|
||||
{{ account }}
|
||||
{% element badge tags=tags %}
|
||||
{{ account.get_brand.name }}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button tags="delete,danger" type="submit" %}
|
||||
{% trans 'Remove' %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% else %}
|
||||
{% element p %}
|
||||
{% trans 'You currently have no third-party accounts connected to this account.' %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% element h2 %}
|
||||
{% trans 'Add a Third-Party Account' %}
|
||||
{% endelement %}
|
||||
{% include "socialaccount/snippets/provider_list.html" with process="connect" %}
|
||||
{% include "socialaccount/snippets/login_extra.html" %}
|
||||
{% endblock content %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{% extends "account/email/base_notification.txt" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block notification_message %}{% blocktrans %}A third-party account from {{ provider }} has been connected to your account.{% endblocktrans %}{% endblock notification_message %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% autoescape off %}
|
||||
{% blocktrans %}Third-Party Account Connected{% endblocktrans %}
|
||||
{% endautoescape %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{% extends "account/email/base_notification.txt" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block notification_message %}{% blocktrans %}A third-party account from {{ provider }} has been disconnected from your account.{% endblocktrans %}{% endblock notification_message %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% autoescape off %}
|
||||
{% blocktrans %}Third-Party Account Disconnected{% endblocktrans %}
|
||||
{% endautoescape %}
|
||||
39
templates/socialaccount/login.html
Normal file
39
templates/socialaccount/login.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Sign In" %}
|
||||
{% endblock head_title %}
|
||||
{% block innercontent %}
|
||||
<div class="user-action-form-wrap">
|
||||
<div class="user-action-form-inner">
|
||||
|
||||
|
||||
{% if process == "connect" %}
|
||||
{% element h1 %}
|
||||
{% blocktrans with provider.name as provider %}Connect {{ provider }}{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% blocktrans with provider.name as provider %}You are about to connect a new third-party account from {{ provider }}.{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% else %}
|
||||
{% element h1 %}
|
||||
{% blocktrans with provider.name as provider %}Sign In Via {{ provider }}{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% blocktrans with provider.name as provider %}You are about to sign in using a third-party account from {{ provider }}.{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% element form method="post" no_visible_fields=True %}
|
||||
{% slot actions %}
|
||||
{% csrf_token %}
|
||||
{% element button type="submit" %}
|
||||
{% trans "Continue" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock innercontent %}
|
||||
15
templates/socialaccount/login_cancelled.html
Normal file
15
templates/socialaccount/login_cancelled.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "socialaccount/base_entrance.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Login Cancelled" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Login Cancelled" %}
|
||||
{% endelement %}
|
||||
{% url 'account_login' as login_url %}
|
||||
{% element p %}
|
||||
{% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to <a href="{{login_url}}">sign in</a>.{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
13
templates/socialaccount/login_redirect.html
Normal file
13
templates/socialaccount/login_redirect.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{% load i18n allauth %}
|
||||
<head>
|
||||
<title>{% translate "Sign In" %} | {{ provider }}</title>
|
||||
<meta http-equiv="refresh" content="0;URL='{{ redirect_to }}'" />
|
||||
</head>
|
||||
<body>
|
||||
{% element p %}
|
||||
<a href="{{ redirect_to }}">{% translate "Continue" %}</a>
|
||||
{% endelement %}
|
||||
</body>
|
||||
</html>
|
||||
2
templates/socialaccount/messages/account_connected.txt
Normal file
2
templates/socialaccount/messages/account_connected.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
{% load i18n %}
|
||||
{% blocktrans %}The third-party account has been connected.{% endblocktrans %}
|
||||
@@ -0,0 +1,2 @@
|
||||
{% load i18n %}
|
||||
{% blocktrans %}The third-party account is already connected to a different account.{% endblocktrans %}
|
||||
@@ -0,0 +1 @@
|
||||
{% extends "socialaccount/messages/account_connected.txt" %}
|
||||
@@ -0,0 +1,2 @@
|
||||
{% load i18n %}
|
||||
{% blocktrans %}The third-party account has been disconnected.{% endblocktrans %}
|
||||
38
templates/socialaccount/signup.html
Normal file
38
templates/socialaccount/signup.html
Normal file
@@ -0,0 +1,38 @@
|
||||
{% extends "base.html" %}
|
||||
{% load socialaccount %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Signup" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
|
||||
<div class="user-action-form-wrap">
|
||||
<div class="user-action-form-inner">
|
||||
|
||||
{% element h1 %}
|
||||
{% trans "Sign Up" %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to
|
||||
{{site_name}}. As a final step, please complete the following form:{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% url 'socialaccount_signup' as action_url %}
|
||||
{% element form form=form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% element fields form=form unlabeled=True %}
|
||||
{% endelement %}
|
||||
{{ redirect_field }}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button type="submit" %}
|
||||
{% trans "Sign Up" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
||||
15
templates/socialaccount/snippets/login.html
Normal file
15
templates/socialaccount/snippets/login.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% load socialaccount %}
|
||||
{% get_providers as socialaccount_providers %}
|
||||
{% if socialaccount_providers %}
|
||||
{% if not SOCIALACCOUNT_ONLY %}
|
||||
{% element hr %}
|
||||
{% endelement %}
|
||||
{% element h2 %}
|
||||
{% translate "Or use a third-party" %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
|
||||
{% include "socialaccount/snippets/login_extra.html" %}
|
||||
{% endif %}
|
||||
2
templates/socialaccount/snippets/login_extra.html
Normal file
2
templates/socialaccount/snippets/login_extra.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{% load socialaccount %}
|
||||
{% providers_media_js %}
|
||||
18
templates/socialaccount/snippets/provider_list.html
Normal file
18
templates/socialaccount/snippets/provider_list.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% load allauth socialaccount %}
|
||||
{% get_providers as socialaccount_providers %}
|
||||
{% if socialaccount_providers %}
|
||||
{% element provider_list %}
|
||||
{% for provider in socialaccount_providers %}
|
||||
{% if provider.id == "openid" %}
|
||||
{% for brand in provider.get_brands %}
|
||||
{% provider_login_url provider openid=brand.openid_url process=process as href %}
|
||||
{% element provider name=brand.name provider_id=provider.id href=href %}
|
||||
{% endelement %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% provider_login_url provider process=process scope=scope auth_params=auth_params as href %}
|
||||
{% element provider name=provider.name provider_id=provider.id href=href %}
|
||||
{% endelement %}
|
||||
{% endfor %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user