47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
from . import utils
|
|
from . import app_settings
|
|
|
|
import django.apps
|
|
|
|
|
|
class Plugin(object):
|
|
def get_before_urls(self):
|
|
from . import urls
|
|
return urls.urlpatterns
|
|
|
|
def get_apps(self):
|
|
return [__name__]
|
|
|
|
def get_authentication_backends(self):
|
|
return ['authentic2_auth_fc.backends.FcBackend']
|
|
|
|
def get_auth_frontends(self):
|
|
return ['authentic2_auth_fc.auth_frontends.FcFrontend']
|
|
|
|
def redirect_logout_list(self, request, **kwargs):
|
|
from django.core.urlresolvers import reverse
|
|
|
|
url = utils.build_logout_url(request, next_url=reverse('auth_logout'))
|
|
# url is assumed empty if no active session on the OP.
|
|
if url:
|
|
return [url]
|
|
return []
|
|
|
|
def registration_form_prefill(self, request):
|
|
if app_settings.enable_registration_form_prefill:
|
|
return [utils.get_mapped_attributes(request)]
|
|
return []
|
|
|
|
|
|
class AppConfig(django.apps.AppConfig):
|
|
|
|
name = __name__
|
|
|
|
def ready(self):
|
|
from .api_views import fc_unlink
|
|
from authentic2.api_views import UsersAPI
|
|
UsersAPI.fc_unlink = fc_unlink
|
|
|
|
|
|
default_app_config = '%s.%s' % (__name__, 'AppConfig')
|