Ajout message pour proposer connexion standard
This commit is contained in:
parent
f614051365
commit
fe7f84ffad
5 changed files with 79 additions and 5 deletions
|
@ -0,0 +1 @@
|
|||
default_app_config = 'kfet.apps.KFetConfig'
|
14
kfet/apps.py
Normal file
14
kfet/apps.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (absolute_import, division,
|
||||
print_function, unicode_literals)
|
||||
from builtins import *
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
class KFetConfig(AppConfig):
|
||||
name = 'kfet'
|
||||
verbose_name = "Application K-Fêt"
|
||||
|
||||
def ready(self):
|
||||
import kfet.signals
|
16
kfet/signals.py
Normal file
16
kfet/signals.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (absolute_import, division,
|
||||
print_function, unicode_literals)
|
||||
from builtins import *
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.signals import user_logged_in
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.dispatch import receiver
|
||||
|
||||
@receiver(user_logged_in)
|
||||
def messages_on_login(sender, request, user, **kwargs):
|
||||
if (not user.username == 'kfet_genericteam'
|
||||
and user.has_perm('kfet.is_team')):
|
||||
messages.info(request, '<a href="%s">Connexion en utilisateur partagé ?</a>' % reverse('kfet.login.genericteam'), extra_tags='safe')
|
|
@ -263,3 +263,37 @@ textarea {
|
|||
display:block;
|
||||
padding:5px 20px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Messages
|
||||
*/
|
||||
|
||||
.messages .alert {
|
||||
padding:10px 15px;
|
||||
margin:0;
|
||||
border:0;
|
||||
border-radius:0;
|
||||
}
|
||||
|
||||
.messages .alert-dismissible {
|
||||
padding-right:35px;
|
||||
}
|
||||
|
||||
.messages .alert .close {
|
||||
top:0;
|
||||
right:0;
|
||||
}
|
||||
|
||||
.messages .alert-info {
|
||||
color:inherit;
|
||||
background-color:#ccc;
|
||||
}
|
||||
|
||||
.messages .alert-error {
|
||||
color:inherit;
|
||||
background-color:rgba(200,16,46,0.2);
|
||||
}
|
||||
|
||||
.messages .alert-success {
|
||||
color:#333;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="row messages">
|
||||
{% for message in messages %}
|
||||
<div class="col-sm-12 item">
|
||||
<div class="alert alert-{{ message.level_tag }} alert-dismissible fade in{% if message.tags %} {{ message.tags }}{% endif %}">
|
||||
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span></button>
|
||||
{% if 'safe' in message.tags %}
|
||||
{{ message|safe }}
|
||||
{% else %}
|
||||
{{ message }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue