Merge branch 'Evarin/highlight_clipper'

Highlight Clipper provider.
Toggle by settings "ALLAUTH_ENS_HIGHLIGHT_CLIPPER".

See merge request cof-geek/django-allauth-ens!9
This commit is contained in:
Aurélien Delobelle 2018-09-30 00:06:00 +02:00
commit b09bada052
10 changed files with 525 additions and 14 deletions

View file

@ -77,6 +77,13 @@ See also the `allauth configuration`_ and `advanced usage`_ docs pages.
**Examples:** ``'my-account'``, ``'/my-account/'`` **Examples:** ``'my-account'``, ``'/my-account/'``
``ALLAUTH_ENS_HIGHLIGHT_CLIPPER``
*Optional* — Boolean (default: `True`).
When set to `True`, displays prominently the Clipper option in the login view
(if you use the `allauth_ens` templates).
***** *****
Views Views
***** *****

Binary file not shown.

View file

@ -0,0 +1,417 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-24 20:10+0200\n"
"PO-Revision-Date: 2018-06-24 20:10+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 1.8.7.1\n"
#: apps.py:7
msgid "ENS Authentication"
msgstr "Connexion pour l'ENS"
#: templates/account/account_inactive.html:5
#: templates/account/account_inactive.html:6
msgid "Account Inactive"
msgstr "Compte inactif"
#: templates/account/account_inactive.html:12
msgid ""
"\n"
" This account is inactive.\n"
" "
msgstr ""
"\n"
" Ce compte est inactif.\n"
" "
#: templates/account/email.html:4 templates/account/email.html:5
msgid "E-mail Addresses"
msgstr "Adresses e-mail"
#: templates/account/email.html:16
msgid ""
"\n"
" The following e-mail addresses are associated with your account:\n"
" "
msgstr ""
"\n"
" Les adresses mails suivantes sont associées à votre compte :\n"
" "
#: templates/account/email.html:30
msgid "This email address is verified."
msgstr "Cette adresse e-mail est vérifiée."
#: templates/account/email.html:34
msgid "This email address is not verified."
msgstr "Cette adresse e-mail n'est pas vérifiée."
#: templates/account/email.html:40
msgid "This is your primary email address."
msgstr "Ceci est votre adresse e-mail primaire."
#: templates/account/email.html:54
msgid "Remove"
msgstr "Supprimer"
#: templates/account/email.html:65
msgid "Re-send verification"
msgstr "Ré-envoyer le message de vérification"
#: templates/account/email.html:77
msgid "Make primary"
msgstr "Rendre principale"
#: templates/account/email.html:90
msgid ""
"\n"
" You currently do not have any e-mail address set up. You should really\n"
" add an e-mail address so you can receive notifications, reset your\n"
" password, etc.\n"
" "
msgstr ""
"\n"
" Vous n'avez actuellement aucune adresse e-mail associée à votre compte.\n"
" Vous devriez vraiment ajouter une adresse e-mail afin que vous puissiez "
"recevoir\n"
" des notifications, réinitialiser votre mot de passe, etc.\n"
" "
#: templates/account/email.html:101
msgid "Add E-mail"
msgstr "Ajouter un e-mail"
#: templates/account/email_confirm.html:5
#: templates/account/email_confirm.html:6
msgid "Confirm E-mail Address"
msgstr "Confirmer l'adresse e-mail"
#: templates/account/email_confirm.html:18
#, python-format
msgid ""
"\n"
" Please confirm that <b>%(email)s</b> is an e-mail address for user\n"
" %(user_display)s.\n"
" "
msgstr ""
"\n"
" Merci de confirmer que <b>%(email)s</b> est une adresse e-mail pour "
"l'utilisateur\n"
" %(user_display)s.\n"
" "
#: templates/account/email_confirm.html:26
msgid "Confirm"
msgstr "Confirmer"
#: templates/account/email_confirm.html:34
#, python-format
msgid ""
"\n"
" This e-mail confirmation link expired or is invalid.<br>\n"
" Please <a href=\"%(email_url)s\">issue a new e-mail confirmation "
"request</a>.\n"
" "
msgstr ""
"\n"
" Ce lien de confirmation d'e-mail a expiré ou est invalide.<br>\n"
" Merci de <a href=\"%(email_url)s\">soumettre une nouvelle requête de "
"confirmation d'e-mail</a>.\n"
" "
#: templates/account/login.html:5 templates/account/login.html:6
#: templates/account/login.html:78
msgid "Sign In"
msgstr "Connexion"
#: templates/account/login.html:14
msgid ""
"\n"
" Authentication failed. Please check your credentials and try "
"again.\n"
" "
msgstr ""
"\n"
" L'authentification a échoué. Merci de vérifier vos identifiants et "
"essayer à nouveau.\n"
" "
#: templates/account/login.html:22
#, python-format
msgid ""
"\n"
" Your are authenticated as %(user_str)s, but are not authorized to "
"access\n"
" this page. Would you like to login to a different account ?\n"
" "
msgstr ""
"\n"
" Vous êtes identifié comme %(user_str)s, mais vous n'être pas "
"autorisé à accéder\n"
" à cette page. Voulez-vous essayer avec un compte différent ?\n"
" "
#: templates/account/login.html:44
msgid "Connect with Clipper"
msgstr "Connexion via Clipper"
#: templates/account/login.html:45
msgid "Other choices"
msgstr "Autres choix"
#: templates/account/login.html:45
msgid "Other ways to sign in/sign up"
msgstr "Autres méthodes de connexion"
#: templates/account/login.html:65
#, fuzzy
msgid ""
"\n"
" Please sign in with one of your existing third party accounts, or with "
"the form below.\n"
" "
msgstr ""
"\n"
" Merci de vous connecter avec un de vos comptes tiers existants, ou avec "
"le formulaire ci-dessous.\n"
" "
#: templates/account/login.html:70
msgid "Forgot Password?"
msgstr "Mot de passe oublié ?"
#: templates/account/login.html:73 templates/account/signup.html:17
#: templates/socialaccount/signup.html:19
msgid "Sign Up"
msgstr "Nouveau compte"
#: templates/account/logout.html:4 templates/account/logout.html:5
#: templates/account/logout.html:20
msgid "Sign Out"
msgstr "Déconnexion"
#: templates/account/logout.html:11
msgid ""
"\n"
" Are you sure you want to sign out?\n"
" "
msgstr ""
"\n"
" Êtes-vous sûr de vouloir vous déconnecter ?\n"
" "
#: templates/account/password_change.html:4
#: templates/account/password_change.html:5
#: templates/account/password_change.html:18
#: templates/account/password_reset_from_key.html:4
#: templates/account/password_reset_from_key.html:5
#: templates/account/password_reset_from_key_done.html:4
#: templates/account/password_reset_from_key_done.html:5
msgid "Change Password"
msgstr "Changer le mot de passe"
#: templates/account/password_reset.html:4
#: templates/account/password_reset.html:5
#: templates/account/password_reset_done.html:4
#: templates/account/password_reset_done.html:5
msgid "Password Reset"
msgstr "Réinitialisation du mot de passe"
#: templates/account/password_reset.html:11
msgid ""
"\n"
" Forgotten your password? Enter your e-mail address below, and we'll "
"send\n"
" you an e-mail allowing you to reset it.\n"
" "
msgstr ""
"\n"
" Vous avez oublié votre mot de passe ? Entrez votre adresse e-mail ci-"
"dessous, et\n"
" nous vous enverrons un e-mail qui vous permettra de le réinitialiser.\n"
" "
#: templates/account/password_reset.html:18
#: templates/account/password_reset_from_key.html:21
msgid "Reset Password"
msgstr "Réinitialiser le mot de passe"
#: templates/account/password_reset_done.html:11
msgid ""
"\n"
" We have sent you an e-mail. Please contact us if you do not receive it "
"within a few minutes.\n"
" "
msgstr ""
"\n"
" Nous vous avons envoyé un e-mail. Merci de nous contacter si vous ne "
"l'avez pas reçu d'ici quelques minutes.\n"
" "
#: templates/account/password_reset_from_key.html:13
#, python-format
msgid ""
"\n"
" The password reset link was invalid, possibly because it has already "
"been used.\n"
" Please request a <a href=\"%(passwd_reset_url)s\">new password reset</"
"a>.\n"
" "
msgstr ""
"\n"
" Le lien de réinitialisation de mot de passe est invalide, possiblement "
"parce qu'il a déjà été utilisé.\n"
" Merci de faire une <a href=\"%(passwd_reset_url)s\">nouvelle demande</"
"a>.\n"
" "
#: templates/account/password_reset_from_key.html:24
msgid "Your password is now changed."
msgstr "Votre mot de passe a été modifié."
#: templates/account/password_reset_from_key_done.html:11
msgid ""
"\n"
" Your password is now changed.\n"
" "
msgstr ""
"\n"
" Votre mot de passe a été modifié.\n"
" "
#: templates/account/password_set.html:4 templates/account/password_set.html:5
#: templates/account/password_set.html:24
msgid "Set Password"
msgstr "Définir le mot de passe"
#: templates/account/password_set.html:17
msgid ""
"\n"
" Your account does not have a password yet. Add one to authenticate "
"without\n"
" third parties.\n"
" "
msgstr ""
"\n"
" Votre compte n'a pas encore de mot de passe. Ajoutez-en un pour vous "
"connecter\n"
" sans compte tiers.\n"
" "
#: templates/account/signup.html:4 templates/account/signup.html:5
#: templates/socialaccount/signup.html:4 templates/socialaccount/signup.html:5
msgid "Signup"
msgstr "Nouveau compte"
#: templates/account/signup.html:12
msgid "Already have an account?"
msgstr "Vous avez déjà un compte ?"
#: templates/account/signup_closed.html:4
#: templates/account/signup_closed.html:5
msgid "Sign Up Closed"
msgstr "Création de compte fermée"
#: templates/account/signup_closed.html:11
msgid ""
"\n"
" We are sorry, but the sign up is currently closed.\n"
" "
msgstr ""
"\n"
" Nous sommes désolés, mais la création de compte est actuellement "
"désactivée.\n"
" "
#: templates/allauth_ens/base.html:71
msgid "Not Connected"
msgstr "Non connecté"
#: templates/socialaccount/authentication_error.html:4
#: templates/socialaccount/authentication_error.html:5
msgid "Login Failure"
msgstr "Échec de la connexion"
#: templates/socialaccount/authentication_error.html:11
msgid ""
"\n"
" An error occured while attempting to login via your social network "
"account.\n"
" "
msgstr ""
"\n"
" Une erreur s'est produite lors de la connexion via le site externe.\n"
" "
#: templates/socialaccount/connections.html:5
#: templates/socialaccount/connections.html:6
#, fuzzy
msgid "Account Connections"
msgstr "Méthodes de connexion"
#: templates/socialaccount/connections.html:13
msgid ""
"\n"
" You can sign in to your account using any of the following third party "
"accounts:\n"
" "
msgstr ""
"\n"
" Vous pouvez vous connecter à votre compte en utilisant n'importe lequel "
"de ces comptes tiers :\n"
" "
#: templates/socialaccount/connections.html:17
msgid ""
"\n"
" You currently have no third party accounts connected to this account.\n"
" "
msgstr ""
"\n"
" Vous n'avez actuellement aucun compte tiers associé à ce compte.\n"
" "
#: templates/socialaccount/login_cancelled.html:4
#: templates/socialaccount/login_cancelled.html:5
msgid "Login Cancelled"
msgstr "Connexion annulée"
#: templates/socialaccount/login_cancelled.html:13
#, fuzzy, python-format
msgid ""
"\n"
" You decided to cancel logging into our site using one of your existing "
"accounts. If this was a mistake, please proceed to <a href=\"%(login_url)s"
"\">sign in</a>."
msgstr ""
"\n"
" Vous avez décidé d'annuler la connexion à notre site via un de vos "
"comptes existants. Si cela était une erreur, merci de retourner à <a href="
"\"%(login_url)s\">la page de connexion</a>."
#: templates/socialaccount/signup.html:11
#, python-format
msgid ""
"\n"
" You are about to use your %(provider_name)s account to login.\n"
" As a final step, please complete the following form:\n"
" "
msgstr ""
"\n"
" Vous êtes sur le point d'utiliser votre compte %(provider_name)s pour "
"vous connecter\n"
" Pour finaliser la procédure, merci de remplir le formulaire suivant :\n"
" "

View file

@ -0,0 +1,35 @@
.content-wrapper.highlight-clipper {
.main-login-choices {
li:not(:first-child) {
margin-top: 5px;
}
a {
display: block;
text-align: center;
background: $gray-lighter;
padding: 35px 20px;
color: $black;
font-size: 1.1em;
@include hover-focus {
background: lighten($brand-primary, 50%);
text-decoration: none;
}
}
}
&:not(.not-clipper) {
width: 100vw;
max-width: 500px;
& > :not(.main-login-choices) {
display: none;
}
}
&.not-clipper {
.main-login-choices {
display: none;
}
}
}

View file

@ -5,3 +5,5 @@
@import "mixins"; @import "mixins";
@import "base"; @import "base";
@import "highlight_clipper";

View file

@ -1,4 +1,4 @@
/* line 5, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 5, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
html, body, div, span, applet, object, iframe, html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code, a, abbr, acronym, address, big, cite, code,
@ -20,45 +20,45 @@ time, mark, audio, video {
vertical-align: baseline; vertical-align: baseline;
} }
/* line 22, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 22, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
html { html {
line-height: 1; line-height: 1;
} }
/* line 24, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 24, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
ol, ul { ol, ul {
list-style: none; list-style: none;
} }
/* line 26, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 26, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
} }
/* line 28, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 28, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
caption, th, td { caption, th, td {
text-align: left; text-align: left;
font-weight: normal; font-weight: normal;
vertical-align: middle; vertical-align: middle;
} }
/* line 30, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 30, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
q, blockquote { q, blockquote {
quotes: none; quotes: none;
} }
/* line 103, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 103, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
q:before, q:after, blockquote:before, blockquote:after { q:before, q:after, blockquote:before, blockquote:after {
content: ""; content: "";
content: none; content: none;
} }
/* line 32, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 32, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
a img { a img {
border: none; border: none;
} }
/* line 116, ../../../vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 116, ../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
display: block; display: block;
} }
@ -775,3 +775,35 @@ section > * + * {
background: #2d672d; background: #2d672d;
color: #fff; color: #fff;
} }
/* line 3, ../../scss/_highlight_clipper.scss */
.content-wrapper.highlight-clipper .main-login-choices li:not(:first-child) {
margin-top: 5px;
}
/* line 7, ../../scss/_highlight_clipper.scss */
.content-wrapper.highlight-clipper .main-login-choices a {
display: block;
text-align: center;
background: #eceeef;
padding: 35px 20px;
color: #000;
font-size: 1.1em;
}
/* line 10, ../../scss/_mixins.scss */
.content-wrapper.highlight-clipper .main-login-choices a:focus, .content-wrapper.highlight-clipper .main-login-choices a:hover {
background: #a8d6fe;
text-decoration: none;
}
/* line 21, ../../scss/_highlight_clipper.scss */
.content-wrapper.highlight-clipper:not(.not-clipper) {
width: 100vw;
max-width: 500px;
}
/* line 25, ../../scss/_highlight_clipper.scss */
.content-wrapper.highlight-clipper:not(.not-clipper) > :not(.main-login-choices) {
display: none;
}
/* line 31, ../../scss/_highlight_clipper.scss */
.content-wrapper.highlight-clipper.not-clipper .main-login-choices {
display: none;
}

View file

@ -30,10 +30,23 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content-extra-classes %}{% is_clipper_highlighted as highlight_clipper %}{% if highlight_clipper %}highlight-clipper{% endif %}{% endblock %}
{% block content %} {% block content %}
{% get_providers as socialaccount_providers %} {% get_providers as socialaccount_providers %}
{% is_clipper_highlighted as highlight_clipper %}
{% if highlight_clipper %}
<section class="main-login-choices">
<ul>
<li><a title="Clipper" href="{% provider_login_url "clipper" process="login" scope=scope auth_params=auth_params %}">{% trans "Connect with Clipper" %}</a></li>
<li><a title="{% trans "Other choices" %}" href="javascript:void(0);" onclick="$('.content-wrapper').toggleClass('not-clipper')">{% trans "Other ways to sign in/sign up" %}</a></li>
</ul>
</section>
{% endif %}
{% if socialaccount_providers %} {% if socialaccount_providers %}
<section id="providers"> <section id="providers">
<ul class="method-list"> <ul class="method-list">
@ -68,7 +81,6 @@
{% endif %} {% endif %}
</form> </form>
</section> </section>
{% endblock %} {% endblock %}
{% block extra_js %} {% block extra_js %}

View file

@ -79,7 +79,7 @@
{% block messages-extra %}{% endblock %} {% block messages-extra %}{% endblock %}
<div class="content-wrapper"> <div class="content-wrapper {% block content-extra-classes %}{% endblock %}">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>

View file

@ -7,7 +7,7 @@
{% for provider in socialaccount_providers %} {% for provider in socialaccount_providers %}
{% if provider.id == "openid" %} {% if provider.id == "openid" %}
{% for brand in provider.get_brands %} {% for brand in provider.get_brands %}
<li class="method-wrapper"> <li class="method-wrapper provider-openid-{{ brand.id }}">
<a title="{{ brand.name }}" <a title="{{ brand.name }}"
href="{% provider_login_url provider.id openid=brand.openid_url process=process %}" href="{% provider_login_url provider.id openid=brand.openid_url process=process %}"
> >
@ -16,9 +16,9 @@
</li> </li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<li class="method-wrapper"> <li class="method-wrapper provider-{{ provider.id }}">
<a title="{{ provider.name }}" <a title="{{ provider.name }}"
href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_parms %}" href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}"
> >
{{ provider.name }} {{ provider.name }}
</a> </a>

View file

@ -33,3 +33,9 @@ def get_profile_url():
def is_open_for_signup(context): def is_open_for_signup(context):
request = context['request'] request = context['request']
return get_adapter(request).is_open_for_signup(request) return get_adapter(request).is_open_for_signup(request)
@simple_tag
def is_clipper_highlighted():
return ('allauth_ens.providers.clipper' in getattr(settings, 'INSTALLED_APPS', [])) \
and getattr(settings, 'ALLAUTH_ENS_HIGHLIGHT_CLIPPER', True)