def bounce(request): client, client_id, auth_index, request_data, redirect_url = get_request_data(request) # For now, if Focus is down, just say that they're not authenticated. # This might not be the best approach, reconsider this. response_data = {'er_autentisert': request.user.is_authenticated()} if request.user.is_authenticated() and not request.db_connections['focus']['is_available']: response_data.update(get_member_data(request.user)) return prepare_response(client, auth_index, response_data, redirect_url)
def signon(request): client, client_id, auth_index, request_data, redirect_url = get_request_data(request) request.session['dntconnect'] = { 'client_id': client_id, 'auth_index': auth_index, # Use this to encrypt the response to the client with the same key/method as the request 'redirect_url': redirect_url, } if not request.user.is_authenticated(): request.session['innmelding.aktivitet'] = { 'aktivitet': True, # TODO: Set to the relevant aktivitet-object 'redirect_url': reverse('connect.views.signon_login'), } return redirect('connect.views.signon_login') else: # A bit slower, but cleaner, to redirect an extra time even though we could # just redirect back to the client directly from here. request.session['dntconnect']['signon'] = u'pålogget' return redirect('connect.views.signon_complete')