0003-misc-inherit-from-authentic2_auh_saml-AppConfig-6973.patch
src/authentic2_auth_fedict/__init__.py | ||
---|---|---|
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 | 17 |
default_app_config = '%s.apps.AppConfig' % __name__ |
18 |
src/authentic2_auth_fedict/apps.py | ||
---|---|---|
16 | 16 | |
17 | 17 |
import json |
18 | 18 | |
19 |
import django.apps |
|
19 |
from authentic2_auth_saml.apps import AppConfig |
|
20 | 20 |
from django.contrib.auth.signals import user_logged_in |
21 | 21 |
from django.utils.translation import ugettext_lazy as _ |
22 | 22 | |
23 | 23 | |
24 |
class AppConfig(django.apps.AppConfig):
|
|
24 |
class AppConfig(AppConfig): |
|
25 | 25 |
name = 'authentic2_auth_fedict' |
26 | 26 | |
27 | 27 |
def ready(self): |
28 |
super().ready() |
|
29 | ||
28 | 30 |
from . import signals |
29 | 31 | |
30 | 32 |
user_logged_in.connect(signals.on_user_logged_in) |
... | ... | |
48 | 50 |
def get_authentication_backends(self): |
49 | 51 |
return ['authentic2_auth_fedict.backends.FedictBackend'] |
50 | 52 | |
51 |
def redirect_logout_list(self, request, next_url=None): |
|
52 |
from mellon.views import logout |
|
53 | ||
54 |
if 'mellon_session' in request.session: |
|
55 |
response = logout(request) |
|
56 |
if 'Location' in response: |
|
57 |
return [response['Location']] |
|
58 |
return [] |
|
59 | ||
60 | 53 |
def registration_form_prefill(self, request): |
61 | 54 |
if request.token.get('first_name'): |
62 | 55 |
return [ |
src/authentic2_auth_fedict/urls.py | ||
---|---|---|
19 | 19 |
from . import views |
20 | 20 | |
21 | 21 |
urlpatterns = [ |
22 |
url(r'^accounts/saml/', include('mellon.urls')), |
|
22 |
url(r'^accounts/saml/', include('mellon.urls'), kwargs={'logout_next_url': '/logout/'}),
|
|
23 | 23 |
url( |
24 | 24 |
r'^accounts/fedict/login/$', |
25 | 25 |
views.login, |
26 |
- |