more cleanup, remove supervisr imports

This commit is contained in:
Jens Langhammer
2018-11-16 10:08:15 +01:00
parent fbaab4efaf
commit a2904d3ade
42 changed files with 130 additions and 245 deletions

View File

@ -17,7 +17,7 @@ class PassbookOAuthClientConfig(AppConfig):
def ready(self):
"""Load source_types from config file"""
source_types_to_load = CONFIG.y('oauth_client.source_tyoes')
source_types_to_load = CONFIG.y('oauth_client.types', [])
for source_type in source_types_to_load:
try:
import_module(source_type)

View File

@ -1,17 +1,11 @@
"""
Supervisr Mod Oauth Client Errors
"""
"""passbook oauth_client Errors"""
class OAuthClientError(Exception):
"""
Base error for all OAuth Client errors
"""
"""Base error for all OAuth Client errors"""
pass
class OAuthClientEmailMissingError(OAuthClientError):
"""
Error which is raised when user is missing email address from profile
"""
"""Error which is raised when user is missing email address from profile"""
pass

View File

@ -1,4 +1,4 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% any_provider as enabled %}
{% if enabled %}

View File

@ -1,6 +1,6 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% provider_exists 'facebook' as facebook_enabled %}
{% if facebook_enabled %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider='facebook' %}" class="btn" style="background-color:#4267b2;color:white;margin-top:10px;width:100%;"><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider='facebook' %}" class="btn" style="background-color:#4267b2;color:white;margin-top:10px;width:100%;"><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
{% endif %}

View File

@ -1,6 +1,6 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% provider_exists 'twitter' as twitter_enabled %}
{% if twitter_enabled %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider='twitter' %}" class="btn" style="background-color:#55ACEE;color:white;margin-top:10px;width:100%;"><i class="fa fa-twitter" aria-hidden="true"></i></a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider='twitter' %}" class="btn" style="background-color:#55ACEE;color:white;margin-top:10px;width:100%;"><i class="fa fa-twitter" aria-hidden="true"></i></a>
{% endif %}

View File

@ -1,7 +1,7 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% load static %}
{% provider_exists 'google' as google_enabled %}
{% if google_enabled %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider='google' %}" class="btn" style="background-color:white;color:black;margin-top:10px;width:100%;"><img src="{% static 'img/google.svg' %}" style="height:12px"></a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider='google' %}" class="btn" style="background-color:white;color:black;margin-top:10px;width:100%;"><img src="{% static 'img/google.svg' %}" style="height:12px"></a>
{% endif %}

View File

@ -1,6 +1,6 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% provider_exists 'github' as github_enabled %}
{% if github_enabled %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider='github' %}" class="btn" style="background-color:#444444;color:white;margin-top:10px;width:100%;"><i class="fa fa-github" aria-hidden="true"></i></a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider='github' %}" class="btn" style="background-color:#444444;color:white;margin-top:10px;width:100%;"><i class="fa fa-github" aria-hidden="true"></i></a>
{% endif %}

View File

@ -1,7 +1,7 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% load static %}
{% provider_exists 'discord' as discord_enabled %}
{% if discord_enabled %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider='discord' %}" class="btn" style="background-color:#2C2F33;color:white;margin-top:10px;width:100%;"><img src="{% static 'img/discord.svg' %}" style="height:12px"></a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider='discord' %}" class="btn" style="background-color:#2C2F33;color:white;margin-top:10px;width:100%;"><img src="{% static 'img/discord.svg' %}" style="height:12px"></a>
{% endif %}

View File

@ -1,7 +1,7 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% load static %}
{% provider_exists 'reddit' as reddit_enabled %}
{% if reddit_enabled %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider='reddit' %}" class="btn" style="background-color:#ff4500;color:white;margin-top:10px;width:100%;"><img src="{% static 'img/reddit.svg' %}" style="height:20px;margin-top:-5px;"></a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider='reddit' %}" class="btn" style="background-color:#ff4500;color:white;margin-top:10px;width:100%;"><img src="{% static 'img/reddit.svg' %}" style="height:20px;margin-top:-5px;"></a>
{% endif %}

View File

@ -1,4 +1,4 @@
{% load supervisr_oauth_client %}
{% load passbook_oauth_client %}
{% any_provider as enabled %}
{% if enabled %}

View File

@ -1,6 +1,6 @@
{% extends "user/base.html" %}
{% load supervisr_utils %}
{% load utils %}
{% load i18n %}
{% block title %}
@ -34,9 +34,9 @@
<td>{{ data.state|yesno:"Connected,Not Connected" }}</td>
<td>
{% if data.state == False %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-login' provider=data.provider.name %}">Connect</a>
<a href="{% url 'passbook_oauth_client:oauth-client-login' provider=data.provider.name %}">Connect</a>
{% else %}
<a href="{% url 'supervisr_mod_auth_oauth_client:oauth-client-disconnect' provider=data.provider.name %}">Disconnect</a>
<a href="{% url 'passbook_oauth_client:oauth-client-disconnect' provider=data.provider.name %}">Disconnect</a>
{% endif %}
</td>
<td>{{ data.aas.first.identifier }}</td>

View File

@ -6,40 +6,7 @@ from passbook.oauth_client.source_types.manager import RequestKind
# from passbook.oauth_client.views import core, settings
from passbook.oauth_client.views import dispatcher
# from passbook.oauth_client.views.providers import (discord, facebook, github,
# google, reddit, supervisr,
# twitter)
urlpatterns = [
# # Supervisr
# url(r'^callback/(?P<provider>supervisr)/$',
# supervisr.SupervisrOAuthCallback.as_view(), name='oauth-client-callback'),
# # Twitter
# url(r'^callback/(?P<provider>twitter)/$',
# twitter.TwitterOAuthCallback.as_view(), name='oauth-client-callback'),
# # GitHub
# url(r'^callback/(?P<provider>github)/$',
# github.GitHubOAuth2Callback.as_view(), name='oauth-client-callback'),
# # Facebook
# url(r'^callback/(?P<provider>facebook)/$',
# facebook.FacebookOAuth2Callback.as_view(), name='oauth-client-callback'),
# url(r'^login/(?P<provider>facebook)/$',
# facebook.FacebookOAuthRedirect.as_view(), name='oauth-client-login'),
# # Discord
# url(r'^callback/(?P<provider>discord)/$',
# discord.DiscordOAuth2Callback.as_view(), name='oauth-client-callback'),
# url(r'^login/(?P<provider>discord)/$',
# discord.DiscordOAuthRedirect.as_view(), name='oauth-client-login'),
# # Reddit
# url(r'^callback/(?P<provider>reddit)/$',
# reddit.RedditOAuth2Callback.as_view(), name='oauth-client-callback'),
# url(r'^login/(?P<provider>reddit)/$',
# reddit.RedditOAuthRedirect.as_view(), name='oauth-client-login'),
# # Google
# url(r'^callback/(?P<provider>google)/$',
# google.GoogleOAuth2Callback.as_view(), name='oauth-client-callback'),
# url(r'^login/(?P<provider>google)/$',
# google.GoogleOAuthRedirect.as_view(), name='oauth-client-login'),
path('login/<slug:source_slug>/', dispatcher.DispatcherView.as_view(
kind=RequestKind.redirect), name='oauth-client-login'),
path('callback/<slug:source_slug>/', dispatcher.DispatcherView.as_view(