def api_access_config(request, template_name='im/api_access_config.html', content_type='text/plain', extra_context=None, filename='.kamakirc'): if settings.KAMAKI_CONFIG_CLOUD_NAME: cloud_name = settings.KAMAKI_CONFIG_CLOUD_NAME else: cloud_name = branding_settings.SERVICE_NAME.replace(' ', '_').lower() url = get_public_endpoint(settings.astakos_services, 'identity') context = { 'user': request.user, 'services': Component.catalog(), 'token_url': url, 'cloud_name': cloud_name } extra_context = extra_context or {} context.update(extra_context) content = branding.render_to_string(template_name, context, RequestContext(request)) response = HttpResponse(content_type=content_type) response.status_code = 200 response['Content-Disposition'] = 'attachment; filename="%s"' % filename response.content = content return response
def api_access(request, template_name='im/api_access.html', extra_context=None): """ API access view. """ context = {} url = get_public_endpoint(settings.astakos_services, 'identity') context['services'] = Component.catalog() context['token_url'] = url context['user'] = request.user context['client_url'] = settings.API_CLIENT_URL if extra_context: context.update(extra_context) context_instance = get_context(request, context) return render_response(template_name, context_instance=context_instance)
def get_services(request): callback = request.GET.get('callback', None) mimetype = 'application/json' data = json.dumps(Component.catalog().values()) if callback: # Consume session messages. When get_services is loaded from an astakos # page, messages should have already been consumed in the html # response. When get_services is loaded from another domain/service we # consume them here so that no stale messages to appear if user visits # an astakos view later on. # TODO: messages could be served to other services/sites in the dict # response of get_services and/or get_menu. Services could handle those # messages respectively. messages_list = list(messages.get_messages(request)) mimetype = 'application/javascript' data = '%s(%s)' % (callback, data) return HttpResponse(content=data, content_type=mimetype)
def landing(request): context = {'services': Component.catalog(orderfor='dashboard')} return render_response('im/landing.html', context_instance=get_context(request), **context)
else: return redirect(reverse('edit_profile')) except ValueError, ve: messages.success(request, ve) elif request.method == "GET": request.user.is_verified = True request.user.save() # existing providers user_providers = request.user.get_enabled_auth_providers() user_disabled_providers = request.user.get_disabled_auth_providers() # providers that user can add user_available_providers = request.user.get_available_auth_providers() extra_context['services'] = Component.catalog().values() return render_response(template_name, profile_form=form, user_providers=user_providers, user_disabled_providers=user_disabled_providers, user_available_providers=user_available_providers, context_instance=get_context( request, extra_context)) @transaction.commit_on_success @require_http_methods(["GET", "POST"]) @cookie_fix def signup(request, template_name='im/signup.html', on_success='index',
def landing(request): context = {'services': Component.catalog(orderfor='dashboard')} return render_response( 'im/landing.html', context_instance=get_context(request), **context)
else: return redirect(reverse('edit_profile')) except ValueError, ve: messages.success(request, ve) elif request.method == "GET": request.user.is_verified = True request.user.save() # existing providers user_providers = request.user.get_enabled_auth_providers() user_disabled_providers = request.user.get_disabled_auth_providers() # providers that user can add user_available_providers = request.user.get_available_auth_providers() extra_context['services'] = Component.catalog().values() return render_response(template_name, profile_form=form, user_providers=user_providers, user_disabled_providers=user_disabled_providers, user_available_providers=user_available_providers, context_instance=get_context(request, extra_context)) @transaction.atomic @require_http_methods(["GET", "POST"]) @cookie_fix def signup(request, template_name='im/signup.html', on_success='index', extra_context=None, activation_backend=None): """