0006-authentic2_auth_fc-rely-on-get_plugins-for-beeing-di.patch
src/authentic2_auth_fc/__init__.py | ||
---|---|---|
21 | 21 |
from django import template |
22 | 22 | |
23 | 23 | |
24 |
class Plugin(object): |
|
25 | ||
26 |
def redirect_logout_list(self, request, **kwargs): |
|
27 |
from django.urls import reverse |
|
28 |
from . import utils |
|
29 | ||
30 |
url = utils.build_logout_url(request, next_url=reverse('auth_logout')) |
|
31 |
# url is assumed empty if no active session on the OP. |
|
32 |
if url: |
|
33 |
return [url] |
|
34 |
return [] |
|
35 | ||
36 |
def registration_form_prefill(self, request): |
|
37 |
from . import utils |
|
38 | ||
39 |
if app_settings.enable_registration_form_prefill: |
|
40 |
return [utils.get_mapped_attributes(request)] |
|
41 |
return [] |
|
42 | ||
43 | ||
24 | 44 |
class AppConfig(django.apps.AppConfig): |
25 | 45 | |
26 | 46 |
name = __name__ |
27 | 47 | |
48 |
def get_a2_plugin(self): |
|
49 |
return Plugin() |
|
50 | ||
28 | 51 |
def ready(self): |
29 | 52 |
from .api_views import fc_unlink |
30 | 53 |
from authentic2.api_views import UsersAPI |
... | ... | |
78 | 101 |
return False |
79 | 102 |
return True |
80 | 103 | |
81 |
def redirect_logout_list(self, request, **kwargs): |
|
82 |
from django.urls import reverse |
|
83 |
from . import utils |
|
84 | ||
85 |
url = utils.build_logout_url(request, next_url=reverse('auth_logout')) |
|
86 |
# url is assumed empty if no active session on the OP. |
|
87 |
if url: |
|
88 |
return [url] |
|
89 |
return [] |
|
90 | ||
91 |
def registration_form_prefill(self, request): |
|
92 |
from . import utils |
|
93 | ||
94 |
if app_settings.enable_registration_form_prefill: |
|
95 |
return [utils.get_mapped_attributes(request)] |
|
96 |
return [] |
|
97 | ||
98 | ||
99 | ||
100 | 104 | |
101 | 105 |
default_app_config = '%s.%s' % (__name__, 'AppConfig') |
102 |
- |