removed social auth methods for login

This commit is contained in:
2018-05-07 23:37:48 +02:00
parent afc471d27f
commit 436a77d036
6 changed files with 20 additions and 69 deletions

View File

@@ -17,5 +17,3 @@ PyJWT
pytz
requests
requests-oauthlib
social-auth-app-django
social-auth-core

View File

@@ -49,7 +49,6 @@ PREREQ_APPS = [
'ckeditor',
'ckeditor_uploader',
'easy_thumbnails',
'social_django',
]
PROJECT_APPS = [
'kasu',
@@ -103,8 +102,6 @@ TEMPLATES = [
'django.contrib.messages.context_processors.messages',
'django.contrib.messages.context_processors.messages',
'events.context_processors.events_overview',
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect'
],
'loaders': [
('django.template.loaders.cached.Loader', [
@@ -132,24 +129,10 @@ DEFAULT_FROM_EMAIL = ""
# Login Settings
ACCOUNT_ACTIVATION_DAYS = 5
AUTH_USER_MODEL = 'membership.Membership'
AUTHENTICATION_BACKENDS = ('social_core.backends.facebook.FacebookOAuth2',
'social_core.backends.google.GoogleOAuth2',
'social_core.backends.twitter.TwitterOAuth',
'django.contrib.auth.backends.ModelBackend',)
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
LOGIN_URL = '/membership/login/'
LOGIN_ERROR_URL = '/membership/login/error/'
LOGIN_REDIRECT_URL = '/users/'
SOCIAL_AUTH_CHANGE_SIGNAL_ONLY = False
SOCIAL_AUTH_ENABLED_BACKENDS = ('facebook-oauth2', 'google-oauth2', 'twitter')
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/users/'
SOCIAL_AUTH_SLUGIFY_USERNAMES = True
SOCIAL_AUTH_FACEBOOK_KEY = ''
SOCIAL_AUTH_FACEBOOK_SECRET = ''
SOCIAL_AUTH_FACEBOOK_SCOPE = ['user_about_me', 'email']
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ''
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
SOCIAL_AUTH_TWITTER_KEY = ''
SOCIAL_AUTH_TWITTER_SECRET = ''
# Localization
USE_I18N = True

View File

@@ -185,12 +185,6 @@
{% trans "no user logged in" %} -
<a rel="nofollow" href="{% url 'membership-register' %}">{% trans "register" %}</a>
<a rel="nofollow" href="{% url 'login' %}?next={{ request.path_info }}">{% trans "login" %}</a>
<a rel="nofollow" href="{% url 'social:begin' 'facebook' %}" class="fa fa-facebook"
title="{% trans 'Login with Facebook' %}" aria-label="{% trans 'Login with Facebook' %}"></a>
<a rel="nofollow" href="{% url 'social:begin' 'twitter' %}" class="fa fa-twitter"
title="{% trans 'Login with Twitter' %}" aria-label="{% trans 'Login with Twitter' %}"></a>
<a rel="nofollow" href="{% url 'social:begin' 'google-oauth2' %}" class="fa fa-google"
title="{% trans 'Login with Google' %}" aria-label="{% trans 'Login with Google' %}"></a>
{% endif %}
</nav>
</body>

View File

@@ -62,7 +62,6 @@ urlpatterns = [ # Ignore PyLintBear (C0103)
url(r'^(?P<path>[\-\d\w\/]+)\.html$',
views.PageHtml.as_view(), name='view-page'),
url(r'^(?P<path>[\-\d\w\/]+)\.pdf$', views.PagePdf.as_view()),
url('', include('social_django.urls', namespace='social'))
]
if settings.DEBUG:

View File

@@ -17,7 +17,7 @@
<img class="grid_3" src="{% thumbnail membership.avatar '220x220' crop='smart' %}" alt="{% trans 'Profile Image' %}"/>{% else %}
<div class="grid_3"> Noch kein Foto hoch geladen</div>{% endif %}
<div class="grid_6">
<div class="{% if membership == user or perms.membership.change_membership%}grid_4{% else %}grid_9{% endif %}" >
{% if kyu_dan_ranking %}
<h3>Mahjong</h3>
<ul>
@@ -36,41 +36,28 @@
</li>
</ul>
{% endif %}
</div>
{% if membership == user or perms.membership.change_membership%}
<div class="grid_5">
<h3>{% trans 'private data' %}</h3>
<p>{% blocktrans %}This data can only be seen by yourself and members of the board.{% endblocktrans %} </p>
<ul>
<li><strong>{% trans "name" %}:</strong> {{membership.first_name}} {{membership.last_name}}</li>
<li><strong>{% trans "birthday" %}:</strong> {{membership.birthday}}</li>
<li><strong>{% trans "Address" %}:</strong> <address>{{ membership.street_name }}<br/> {{ membership.post_code }} {{ membership.city }}</address></li>
<li><strong>{% trans "Email" %}:</strong> <a href="mailto:{{ membership.email }}">{{membership.email}}</a></li>
<li><strong>{% trans "Telephone" %}:</strong> <a href="tel:{{ membership.telephone }}">{{membership.telephone}}</a></li>
{% if membership.first_name %}<li><strong>{% trans "name" %}:</strong> {{membership.first_name}} {{membership.last_name}}</li>{% endif %}
{% if membership.birthday %}<li><strong>{% trans "birthday" %}:</strong> {{membership.birthday}}</li>{% endif %}
{% if membership.street_name %}<li><strong>{% trans "Address" %}:</strong> <address>{{ membership.street_name }}<br/> {{ membership.post_code }} {{ membership.city }}</address></li>{% endif %}
{% if membership.email %}<li><strong>{% trans "Email" %}:</strong> <a href="mailto:{{ membership.email }}">{{membership.email}}</a></li>{% endif %}
{% if membership.telephone %}<li><strong>{% trans "Telephone" %}:</strong> <a href="tel:{{ membership.telephone }}">{{membership.telephone}}</a></li>{% endif %}
<li><strong>{% trans "Member Since" %}:</strong> {{membership.date_joined}}</li>
<li><strong>{% trans "Last Login" %}:</strong> {{membership.last_login}}</li>
{% if website %}
<li><strong>Homepage:</strong> <a href="{{website}}">{{website}}</a></li>
{% endif %}
</ul>
{% ifequal membership user %}
<a href="{% url 'membership-edit' membership.username %}" class="button"> <span class="fa fa-pencil"></span> {% trans "Edit Profile" %} </a>
<a href="{% url 'password_change' %}" class="button"> <span class="fa fa-key"></span> {% trans 'Change Password' %}</a>
{% endifequal %}
</div>
{% endif %}
</div>
{% ifequal membership user %}
<div class="grid_3">
<a href="{% url 'membership-edit' membership.username %}" class="button"> <span class="fa fa-pencil"></span> {% trans "Edit Profile" %} </a>
<a href="{% url 'password_change' %}" class="button"> <span class="fa fa-key"></span> {% trans 'Change Password' %} </a>
<a class="button" href="{% url 'social:begin' 'facebook' %}" rel="nofollow">
<span class="fa fa-facebook"></span> {% blocktrans with 'Facebook' as name %}Associate with {{ name }}{% endblocktrans %} </a>
<a class="button" href="{% url 'social:begin' 'twitter' %}" rel="nofollow">
<span class="fa fa-twitter"></span> {% blocktrans with 'Twitter' as name %}Associate with {{ name }}{% endblocktrans %} </a>
<a class="button" href="{% url 'social:begin' 'google-oauth2' %}" rel="nofollow">
<span class="fa fa-google-plus"></span> {% blocktrans with 'Google' as name %}Associate with {{ name }}{% endblocktrans %} </a>
</div>{% endifequal %}
{% block score_list %} {% endblock %}{% endblock %}

View File

@@ -9,9 +9,12 @@
{% block maincontent %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<div class="grid_5">
<div class="grid_6">
{{ current_page.content }}
</div>
<div class="grid_6">
<fieldset>
<legend>&nbsp;</legend>
<legend>{% trans 'login' %}</legend>
{% csrf_token %} {% include 'form.html' %} {% if form.errors %}
<p>{% blocktrans %}Your username and password didn't match. Please try again.{% endblocktrans %}</p>
{% endif %} <input type="hidden" name="next" value="{{next}}"/>
@@ -25,19 +28,6 @@
</div>
</fieldset>
</div>
<div class="grid_2">
<h2>{% trans 'or' %}</h2>
</div>
<div class="grid_5">
<a class="button" rel="nofollow" href="{% url 'social:begin' 'facebook' %}">
<span class="fa fa-facebook fa-2x"></span> {% trans 'Login with Facebook' %}</a><br/>
<a class="button" rel="nofollow" href="{% url 'social:begin' 'twitter' %}">
<span class="fa fa-twitter fa-2x"></span> {% trans 'Login with Twitter' %}</a><br/>
<a class="button" rel="nofollow" href="{% url 'social:begin' 'google-oauth2' %}">
<span class="fa fa-google-plus fa-2x"></span> {% trans 'Login with Google' %}</a>
</div>
</form>
<div class="grid_12">
{{ current_page.content }}
</div>{% endblock %}
{% endblock %}