From 74cd0bc08f5bc48c6cd7f596df05fa41b3a4ae34 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 5 Dec 2019 15:07:37 +0100 Subject: [PATCH] all(minor): remove old, unused code --- passbook/lib/templatetags/reflection.py | 88 -------------- passbook/lib/templatetags/utils.py | 107 +----------------- .../oauth/locale/de/LC_MESSAGES/django.po | 70 ------------ .../oauth/locale/en/LC_MESSAGES/django.po | 69 ----------- .../oauth/locale/es/LC_MESSAGES/django.po | 70 ------------ .../oauth/locale/fr/LC_MESSAGES/django.po | 70 ------------ passbook/root/settings.py | 7 -- .../oauth/locale/de/LC_MESSAGES/django.po | 80 ------------- .../oauth/locale/en/LC_MESSAGES/django.po | 79 ------------- .../oauth/locale/es/LC_MESSAGES/django.po | 80 ------------- .../oauth/locale/fr/LC_MESSAGES/django.po | 80 ------------- passbook/sources/saml/xml_signing.py | 66 ----------- scripts/pre-commit.sh | 5 + 13 files changed, 6 insertions(+), 865 deletions(-) delete mode 100644 passbook/lib/templatetags/reflection.py delete mode 100644 passbook/providers/oauth/locale/de/LC_MESSAGES/django.po delete mode 100644 passbook/providers/oauth/locale/en/LC_MESSAGES/django.po delete mode 100644 passbook/providers/oauth/locale/es/LC_MESSAGES/django.po delete mode 100644 passbook/providers/oauth/locale/fr/LC_MESSAGES/django.po delete mode 100644 passbook/sources/oauth/locale/de/LC_MESSAGES/django.po delete mode 100644 passbook/sources/oauth/locale/en/LC_MESSAGES/django.po delete mode 100644 passbook/sources/oauth/locale/es/LC_MESSAGES/django.po delete mode 100644 passbook/sources/oauth/locale/fr/LC_MESSAGES/django.po delete mode 100644 passbook/sources/saml/xml_signing.py create mode 100755 scripts/pre-commit.sh diff --git a/passbook/lib/templatetags/reflection.py b/passbook/lib/templatetags/reflection.py deleted file mode 100644 index c66355b6a..000000000 --- a/passbook/lib/templatetags/reflection.py +++ /dev/null @@ -1,88 +0,0 @@ -"""passbook Core Reflection templatetags Templatetag""" -from django import template -from structlog import get_logger - -register = template.Library() -LOGGER = get_logger() - - -def get_key_unique(context): - """Get a unique key for cache based on user""" - uniq = '' - if 'request' in context: - user = context.get('request').user - if user.is_authenticated: - uniq = context.get('request').user.email - else: - # This should never be reached as modlist requires admin rights - uniq = 'anon' # pragma: no cover - return uniq - -# @register.simple_tag(takes_context=True) -# def sv_reflection_admin_modules(context): -# """Get a list of all modules and their admin page""" -# key = 'sv_reflection_admin_modules_%s' % get_key_unique(context) -# if not cache.get(key): -# view_list = [] -# for app in get_apps(): -# title = app.title_modifier(context.request) -# url = app.admin_url_name -# view_list.append({ -# 'url': url, -# 'default': True if url == SupervisrAppConfig.admin_url_name else False, -# 'name': title, -# }) -# sorted_list = sorted(view_list, key=lambda x: x.get('name')) -# cache.set(key, sorted_list, 1000) -# return sorted_list -# return cache.get(key) # pragma: no cover - - -# @register.simple_tag(takes_context=True) -# def sv_reflection_user_modules(context): -# """Get a list of modules that have custom user settings""" -# key = 'sv_reflection_user_modules_%s' % get_key_unique(context) -# if not cache.get(key): -# app_list = [] -# for app in get_apps(): -# if not app.name.startswith('supervisr.mod'): -# continue -# view = app.view_user_settings -# if view is not None: -# app_list.append({ -# 'title': app.title_modifier(context.request), -# 'view': '%s:%s' % (app.label, view) -# }) -# sorted_list = sorted(app_list, key=lambda x: x.get('title')) -# cache.set(key, sorted_list, 1000) -# return sorted_list -# return cache.get(key) # pragma: no cover - - -# @register.simple_tag(takes_context=True) -# def sv_reflection_navbar_modules(context): -# """Get a list of subapps for the navbar""" -# key = 'sv_reflection_navbar_modules_%s' % get_key_unique(context) -# if not cache.get(key): -# app_list = [] -# for app in get_apps(): -# LOGGER.debug("Considering %s for Navbar", app.label) -# title = app.title_modifier(context.request) -# if app.navbar_enabled(context.request): -# index = getattr(app, 'index', None) -# if not index: -# index = '%s:index' % app.label -# try: -# reverse(index) -# LOGGER.debug("Module %s made it with '%s'", app.name, index) -# app_list.append({ -# 'label': app.label, -# 'title': title, -# 'index': index -# }) -# except NoReverseMatch: -# LOGGER.debug("View '%s' not reversable, ignoring %s", index, app.name) -# sorted_list = sorted(app_list, key=lambda x: x.get('label')) -# cache.set(key, sorted_list, 1000) -# return sorted_list -# return cache.get(key) # pragma: no cover diff --git a/passbook/lib/templatetags/utils.py b/passbook/lib/templatetags/utils.py index d1ec22943..72e4aea9a 100644 --- a/passbook/lib/templatetags/utils.py +++ b/passbook/lib/templatetags/utils.py @@ -1,22 +1,14 @@ """passbook lib Templatetags""" -import glob -import os -import socket from hashlib import md5 -from importlib import import_module -from urllib.parse import urlencode, urljoin +from urllib.parse import urlencode from django import template from django.apps import apps -from django.conf import settings from django.db.models import Model -from django.template.loaders.app_directories import get_app_template_dirs -from django.urls import reverse from django.utils.html import escape from django.utils.translation import ugettext as _ from passbook.lib.config import CONFIG -from passbook.lib.utils.reflection import path_to_class from passbook.lib.utils.urls import is_url_absolute register = template.Library() @@ -48,34 +40,6 @@ def fieldtype(field): return field.__class__.__name__ -@register.simple_tag -def setting(key, default=''): - """Returns a setting from the settings.py file. If Key is blocked, return default""" - return getattr(settings, key, default) - - -@register.simple_tag -def hostname(): - """Return the current Host's short hostname""" - return socket.gethostname() - - -@register.simple_tag -def fqdn(): - """Return the current Host's FQDN.""" - return socket.getfqdn() - - -@register.filter('pick') -def pick(cont, arg, fallback=''): - """Iterate through arg and return first choice which is not None""" - choices = arg.split(',') - for choice in choices: - if choice in cont and cont[choice] is not None: - return cont[choice] - return fallback - - @register.simple_tag(takes_context=True) def title(context, *title): """Return either just branding or title - branding""" @@ -106,81 +70,12 @@ def config(path, default=''): return CONFIG.y(path, default) -@register.simple_tag() -def media(*args): - """Iterate through arg and return full media URL""" - urls = [] - for arg in args: - urls.append(urljoin(settings.MEDIA_URL, str(arg))) - if len(urls) == 1: - return urls[0] - return urls - - -@register.simple_tag -def url_unpack(view, kwargs): - """Reverses a URL with kwargs which are stored in a dict""" - return reverse(view, kwargs=kwargs) - - -@register.simple_tag -def template_wildcard(*args): - """Return a list of all templates in dir""" - templates = [] - for tmpl_dir in args: - for app_templates in get_app_template_dirs('templates'): - path = os.path.join(app_templates, tmpl_dir) - if os.path.isdir(path): - files = sorted(glob.glob(path + '*.html')) - for file in files: - templates.append(os.path.relpath(file, start=app_templates)) - return templates - - -@register.simple_tag(takes_context=True) -def related_models(context, model_path): - """Return list of models which have a Relationship to current user""" - - request = context.get('request', None) - if not request: - # No Request -> no user -> return empty - return [] - user = request.user - - model = path_to_class(model_path) - # if not issubclass(model, UserAcquirable): - # # model_path is not actually a module - # # so we can't assume that it's usable - # return [] - - return model.objects.filter(users__in=[user]) - - -@register.filter('unslug') -def unslug(_input): - """Convert slugs back into normal strings""" - return _input.replace('-', ' ').replace('_', ' ') - - @register.filter(name='css_class') def css_class(field, css): """Add css class to form field""" return field.as_widget(attrs={"class": css}) -@register.simple_tag -def app_versions(): - """Return dictionary of app_name: version""" - app_versions = {} - for app in apps.get_app_configs(): - ver_module = import_module(app.name) - ver = getattr(ver_module, '__version__', None) - if ver: - if not isinstance(ver, str): - ver = '.'.join([str(x) for x in ver]) - app_versions[app.verbose_name] = ver - return app_versions - @register.simple_tag def gravatar(email, size=None, rating=None): """ diff --git a/passbook/providers/oauth/locale/de/LC_MESSAGES/django.po b/passbook/providers/oauth/locale/de/LC_MESSAGES/django.po deleted file mode 100644 index e056be3c4..000000000 --- a/passbook/providers/oauth/locale/de/LC_MESSAGES/django.po +++ /dev/null @@ -1,70 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-16 18:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: templates/oauth2_provider/authorize.html:18 -msgid "SSO - Authorize External Source" -msgstr "" - -#: templates/oauth2_provider/authorize.html:29 -#, python-format -msgid "" -"\n" -" You're about to sign into %(remote)s\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:33 -msgid "Application requires following permissions" -msgstr "" - -#: templates/oauth2_provider/authorize.html:42 -#, python-format -msgid "" -"\n" -" You are logged in as %(user)s. Not you?\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:45 -msgid "Logout" -msgstr "" - -#: templates/oauth2_provider/authorize.html:49 -msgid "Continue" -msgstr "" - -#: templates/oauth2_provider/authorize.html:52 -msgid "Cancel" -msgstr "" - -#: templates/oauth2_provider/authorize.html:59 -#, python-format -msgid "Error: %(err)s" -msgstr "" - -#: views/oauth2.py:49 -#, python-format -msgid "You authenticated %s (via OAuth) (skipped Authz)" -msgstr "" - -#: views/oauth2.py:62 -#, python-format -msgid "You authenticated %s (via OAuth)" -msgstr "" diff --git a/passbook/providers/oauth/locale/en/LC_MESSAGES/django.po b/passbook/providers/oauth/locale/en/LC_MESSAGES/django.po deleted file mode 100644 index 2dd4f4480..000000000 --- a/passbook/providers/oauth/locale/en/LC_MESSAGES/django.po +++ /dev/null @@ -1,69 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-20 10:47+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: templates/oauth2_provider/authorize.html:18 -msgid "SSO - Authorize External Source" -msgstr "" - -#: templates/oauth2_provider/authorize.html:29 -#, python-format -msgid "" -"\n" -" You're about to sign into %(remote)s\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:33 -msgid "Application requires following permissions" -msgstr "" - -#: templates/oauth2_provider/authorize.html:42 -#, python-format -msgid "" -"\n" -" You are logged in as %(user)s. Not you?\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:45 -msgid "Logout" -msgstr "" - -#: templates/oauth2_provider/authorize.html:49 -msgid "Continue" -msgstr "" - -#: templates/oauth2_provider/authorize.html:52 -msgid "Cancel" -msgstr "" - -#: templates/oauth2_provider/authorize.html:59 -#, python-format -msgid "Error: %(err)s" -msgstr "" - -#: views/oauth2.py:49 -#, python-format -msgid "You authenticated %s (via OAuth) (skipped Authz)" -msgstr "" - -#: views/oauth2.py:62 -#, python-format -msgid "You authenticated %s (via OAuth)" -msgstr "" diff --git a/passbook/providers/oauth/locale/es/LC_MESSAGES/django.po b/passbook/providers/oauth/locale/es/LC_MESSAGES/django.po deleted file mode 100644 index e056be3c4..000000000 --- a/passbook/providers/oauth/locale/es/LC_MESSAGES/django.po +++ /dev/null @@ -1,70 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-16 18:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: templates/oauth2_provider/authorize.html:18 -msgid "SSO - Authorize External Source" -msgstr "" - -#: templates/oauth2_provider/authorize.html:29 -#, python-format -msgid "" -"\n" -" You're about to sign into %(remote)s\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:33 -msgid "Application requires following permissions" -msgstr "" - -#: templates/oauth2_provider/authorize.html:42 -#, python-format -msgid "" -"\n" -" You are logged in as %(user)s. Not you?\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:45 -msgid "Logout" -msgstr "" - -#: templates/oauth2_provider/authorize.html:49 -msgid "Continue" -msgstr "" - -#: templates/oauth2_provider/authorize.html:52 -msgid "Cancel" -msgstr "" - -#: templates/oauth2_provider/authorize.html:59 -#, python-format -msgid "Error: %(err)s" -msgstr "" - -#: views/oauth2.py:49 -#, python-format -msgid "You authenticated %s (via OAuth) (skipped Authz)" -msgstr "" - -#: views/oauth2.py:62 -#, python-format -msgid "You authenticated %s (via OAuth)" -msgstr "" diff --git a/passbook/providers/oauth/locale/fr/LC_MESSAGES/django.po b/passbook/providers/oauth/locale/fr/LC_MESSAGES/django.po deleted file mode 100644 index 8a1431d6e..000000000 --- a/passbook/providers/oauth/locale/fr/LC_MESSAGES/django.po +++ /dev/null @@ -1,70 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-16 18:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: templates/oauth2_provider/authorize.html:18 -msgid "SSO - Authorize External Source" -msgstr "" - -#: templates/oauth2_provider/authorize.html:29 -#, python-format -msgid "" -"\n" -" You're about to sign into %(remote)s\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:33 -msgid "Application requires following permissions" -msgstr "" - -#: templates/oauth2_provider/authorize.html:42 -#, python-format -msgid "" -"\n" -" You are logged in as %(user)s. Not you?\n" -" " -msgstr "" - -#: templates/oauth2_provider/authorize.html:45 -msgid "Logout" -msgstr "" - -#: templates/oauth2_provider/authorize.html:49 -msgid "Continue" -msgstr "" - -#: templates/oauth2_provider/authorize.html:52 -msgid "Cancel" -msgstr "" - -#: templates/oauth2_provider/authorize.html:59 -#, python-format -msgid "Error: %(err)s" -msgstr "" - -#: views/oauth2.py:49 -#, python-format -msgid "You authenticated %s (via OAuth) (skipped Authz)" -msgstr "" - -#: views/oauth2.py:62 -#, python-format -msgid "You authenticated %s (via OAuth)" -msgstr "" diff --git a/passbook/root/settings.py b/passbook/root/settings.py index ecd2c9fa5..b557f1c73 100644 --- a/passbook/root/settings.py +++ b/passbook/root/settings.py @@ -108,13 +108,6 @@ GUARDIAN_MONKEY_PATCH = False SWAGGER_SETTINGS = { 'DEFAULT_INFO': 'passbook.api.v2.urls.info', - # 'SECURITY_DEFINITIONS': { - # 'JWT': { - # 'type': 'apiKey', - # 'name': 'Authorization', - # 'in': 'header' - # } - # } } REST_FRAMEWORK = { diff --git a/passbook/sources/oauth/locale/de/LC_MESSAGES/django.po b/passbook/sources/oauth/locale/de/LC_MESSAGES/django.po deleted file mode 100644 index 739493dc7..000000000 --- a/passbook/sources/oauth/locale/de/LC_MESSAGES/django.po +++ /dev/null @@ -1,80 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-16 18:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: templates/mod/auth/oauth/client/settings.html:11 -msgid "OAuth2" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:16 -msgid "Connected Accounts" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:23 -msgid "Provider" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:24 -msgid "Status" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:25 -msgid "Action" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:26 -msgid "ID" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:48 -msgid "No Providers configured!" -msgstr "" - -#: views/core.py:126 -#, python-format -msgid "Provider %(name)s didn't provide an E-Mail address." -msgstr "" - -#: views/core.py:184 views/core.py:225 -#, python-format -msgid "Successfully authenticated with %(provider)s!" -msgstr "" - -#: views/core.py:192 -msgid "Authentication Failed." -msgstr "" - -#: views/core.py:204 -#, python-format -msgid "Linked user with OAuth Provider %s" -msgstr "" - -#: views/core.py:208 -#, python-format -msgid "Successfully linked %(provider)s!" -msgstr "" - -#: views/core.py:221 -#, python-format -msgid "Authenticated user with OAuth Provider %s" -msgstr "" - -#: views/core.py:247 -msgid "Connection successfully deleted" -msgstr "" diff --git a/passbook/sources/oauth/locale/en/LC_MESSAGES/django.po b/passbook/sources/oauth/locale/en/LC_MESSAGES/django.po deleted file mode 100644 index caa48b7ee..000000000 --- a/passbook/sources/oauth/locale/en/LC_MESSAGES/django.po +++ /dev/null @@ -1,79 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-20 10:47+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: templates/mod/auth/oauth/client/settings.html:11 -msgid "OAuth2" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:16 -msgid "Connected Accounts" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:23 -msgid "Provider" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:24 -msgid "Status" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:25 -msgid "Action" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:26 -msgid "ID" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:48 -msgid "No Providers configured!" -msgstr "" - -#: views/core.py:126 -#, python-format -msgid "Provider %(name)s didn't provide an E-Mail address." -msgstr "" - -#: views/core.py:184 views/core.py:225 -#, python-format -msgid "Successfully authenticated with %(provider)s!" -msgstr "" - -#: views/core.py:192 -msgid "Authentication Failed." -msgstr "" - -#: views/core.py:204 -#, python-format -msgid "Linked user with OAuth Provider %s" -msgstr "" - -#: views/core.py:208 -#, python-format -msgid "Successfully linked %(provider)s!" -msgstr "" - -#: views/core.py:221 -#, python-format -msgid "Authenticated user with OAuth Provider %s" -msgstr "" - -#: views/core.py:247 -msgid "Connection successfully deleted" -msgstr "" diff --git a/passbook/sources/oauth/locale/es/LC_MESSAGES/django.po b/passbook/sources/oauth/locale/es/LC_MESSAGES/django.po deleted file mode 100644 index 739493dc7..000000000 --- a/passbook/sources/oauth/locale/es/LC_MESSAGES/django.po +++ /dev/null @@ -1,80 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-16 18:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: templates/mod/auth/oauth/client/settings.html:11 -msgid "OAuth2" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:16 -msgid "Connected Accounts" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:23 -msgid "Provider" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:24 -msgid "Status" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:25 -msgid "Action" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:26 -msgid "ID" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:48 -msgid "No Providers configured!" -msgstr "" - -#: views/core.py:126 -#, python-format -msgid "Provider %(name)s didn't provide an E-Mail address." -msgstr "" - -#: views/core.py:184 views/core.py:225 -#, python-format -msgid "Successfully authenticated with %(provider)s!" -msgstr "" - -#: views/core.py:192 -msgid "Authentication Failed." -msgstr "" - -#: views/core.py:204 -#, python-format -msgid "Linked user with OAuth Provider %s" -msgstr "" - -#: views/core.py:208 -#, python-format -msgid "Successfully linked %(provider)s!" -msgstr "" - -#: views/core.py:221 -#, python-format -msgid "Authenticated user with OAuth Provider %s" -msgstr "" - -#: views/core.py:247 -msgid "Connection successfully deleted" -msgstr "" diff --git a/passbook/sources/oauth/locale/fr/LC_MESSAGES/django.po b/passbook/sources/oauth/locale/fr/LC_MESSAGES/django.po deleted file mode 100644 index f0b626fab..000000000 --- a/passbook/sources/oauth/locale/fr/LC_MESSAGES/django.po +++ /dev/null @@ -1,80 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-16 18:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: templates/mod/auth/oauth/client/settings.html:11 -msgid "OAuth2" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:16 -msgid "Connected Accounts" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:23 -msgid "Provider" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:24 -msgid "Status" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:25 -msgid "Action" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:26 -msgid "ID" -msgstr "" - -#: templates/mod/auth/oauth/client/settings.html:48 -msgid "No Providers configured!" -msgstr "" - -#: views/core.py:126 -#, python-format -msgid "Provider %(name)s didn't provide an E-Mail address." -msgstr "" - -#: views/core.py:184 views/core.py:225 -#, python-format -msgid "Successfully authenticated with %(provider)s!" -msgstr "" - -#: views/core.py:192 -msgid "Authentication Failed." -msgstr "" - -#: views/core.py:204 -#, python-format -msgid "Linked user with OAuth Provider %s" -msgstr "" - -#: views/core.py:208 -#, python-format -msgid "Successfully linked %(provider)s!" -msgstr "" - -#: views/core.py:221 -#, python-format -msgid "Authenticated user with OAuth Provider %s" -msgstr "" - -#: views/core.py:247 -msgid "Connection successfully deleted" -msgstr "" diff --git a/passbook/sources/saml/xml_signing.py b/passbook/sources/saml/xml_signing.py deleted file mode 100644 index f6556d21a..000000000 --- a/passbook/sources/saml/xml_signing.py +++ /dev/null @@ -1,66 +0,0 @@ -#XXX: Use svn:externals to get the same version as in saml2idp??? -""" -Signing code goes here. -""" -# # python: -# import hashlib -# import string - -from structlog import get_logger - -# other libraries: -# this app: -# from passbook.providers.saml.utils import nice64 -# from passbook.sources.saml.xml_templates import SIGNATURE, SIGNED_INFO - -LOGGER = get_logger() - -# def get_signature_xml(subject, reference_uri): -# """ -# Returns XML Signature for subject. -# """ -# private_key_file = saml2sp_settings.SAML2SP_PRIVATE_KEY_FILE -# certificate_file = saml2sp_settings.SAML2SP_CERTIFICATE_FILE -# LOGGER.debug('get_signature_xml - Begin.') -# LOGGER.debug('Using private key file: ' + private_key_file) -# LOGGER.debug('Using certificate file: ' + certificate_file) -# LOGGER.debug('Subject: ' + subject) - -# # Hash the subject. -# subject_hash = hashlib.sha1() -# subject_hash.update(subject) -# subject_digest = nice64(subject_hash.digest()) -# LOGGER.debug('Subject digest: ' + subject_digest) - -# # Create signed_info. -# signed_info = string.Template(SIGNED_INFO).substitute({ -# 'REFERENCE_URI': reference_uri, -# 'SUBJECT_DIGEST': subject_digest, -# }) -# LOGGER.debug('SignedInfo XML: ' + signed_info) - -# # # "Digest" the signed_info. -# # info_hash = hashlib.sha1() -# # info_hash.update(signed_info) -# # info_digest = info_hash.digest() -# # LOGGER.debug('Info digest: ' + nice64(info_digest)) - -# # RSA-sign the signed_info. -# private_key = M2Crypto.EVP.load_key(private_key_file) -# private_key.sign_init() -# private_key.sign_update(signed_info) -# rsa_signature = nice64(private_key.sign_final()) -# LOGGER.debug('RSA Signature: ' + rsa_signature) - -# # Load the certificate. -# cert_data = load_cert_data(certificate_file) - -# # Put the signed_info and rsa_signature into the XML signature. -# signed_info_short = signed_info.replace('xmlns:ds="http://www.w3.org/2000/09/xmldsig#"', '') -# signature_xml = string.Template(SIGNATURE).substitute({ -# 'RSA_SIGNATURE': rsa_signature, -# 'SIGNED_INFO': signed_info_short, -# 'CERTIFICATE': cert_data, -# }) -# LOGGER.debug('Signature XML: ' + signature_xml) -# return signature_xml diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh new file mode 100755 index 000000000..14a0cb325 --- /dev/null +++ b/scripts/pre-commit.sh @@ -0,0 +1,5 @@ +#!/bin/bash -xe +isort +pylint passbook +prospector +scripts/coverage.sh