This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
authentic2-auth-fc/src/authentic2_auth_fc/auth_frontends.py

30 lines
958 B
Python

from django.utils.translation import gettext_noop
from django.template.loader import render_to_string
from django.template import RequestContext
from django.shortcuts import render
from . import app_settings
class FcFrontend(object):
def enabled(self):
return app_settings.enabled
def name(self):
return gettext_noop('France Connect')
def id(self):
return 'fc'
def login(self, request, *args, **kwargs):
if 'nofc' in request.GET:
return
context_instance = kwargs.pop('context_instance', None)
return render(request, 'authentic2_auth_fc/login.html',
context_instance=context_instance)
def profile(self, request, *args, **kwargs):
context_instance = kwargs.pop('context_instance', None) or RequestContext(request)
return render_to_string('authentic2_auth_fc/linking.html', {'popup': True},
context_instance=context_instance)