super basic working example
This commit is contained in:
parent
6992bf83aa
commit
098f88e0b8
@ -152,7 +152,7 @@ class OwnerRequiredMixin(object):
|
||||
_('You are not logged in and therefore cannot view this page!')
|
||||
)
|
||||
return HttpResponseRedirect(
|
||||
reverse_lazy('login') + '?next=' + request.path
|
||||
reverse_lazy('account_login') + '?next=' + request.path
|
||||
)
|
||||
else:
|
||||
if not is_object_owner(request.user, self.get_object()):
|
||||
|
@ -149,13 +149,13 @@
|
||||
<a class="dropdown-item" href="{% url 'api:api-root' %}"><i
|
||||
class="fas fa-file-code fa-fw"></i> {% trans 'API Browser' %}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{% url 'logout' %}"><i
|
||||
<a class="dropdown-item" href="{% url 'account_logout' %}"><i
|
||||
class="fas fa-sign-out-alt fa-fw"></i> {% trans 'Logout' %}</a>
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'login' %}">{% trans 'Login' %} <i class="fas fa-sign-in-alt"></i></a>
|
||||
<a class="nav-link" href="{% url 'account_logout' %}">{% trans 'Login' %} <i class="fas fa-sign-in-alt"></i></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -13,7 +13,7 @@
|
||||
{% endif %}
|
||||
|
||||
|
||||
<form role="form" class="form-horizontal" method="post" action="{% url 'login' %}">
|
||||
<form role="form" class="form-horizontal" method="post" action="{% url 'account_login' %}">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
|
||||
|
@ -48,7 +48,7 @@ def index(request):
|
||||
page_map.get(request.user.userpreference.default_page)
|
||||
)
|
||||
except UserPreference.DoesNotExist:
|
||||
return HttpResponseRedirect(reverse('login') + '?next=' + request.path)
|
||||
return HttpResponseRedirect(reverse('account_login') + '?next=' + request.path)
|
||||
|
||||
|
||||
def search(request):
|
||||
@ -87,7 +87,7 @@ def search(request):
|
||||
{'recipes': table, 'filter': f, 'last_viewed': last_viewed}
|
||||
)
|
||||
else:
|
||||
return HttpResponseRedirect(reverse('login') + '?next=' + request.path)
|
||||
return HttpResponseRedirect(reverse('account_login') + '?next=' + request.path)
|
||||
|
||||
|
||||
def recipe_view(request, pk, share=None):
|
||||
@ -99,7 +99,7 @@ def recipe_view(request, pk, share=None):
|
||||
messages.ERROR,
|
||||
_('You do not have the required permissions to view this page!')
|
||||
)
|
||||
return HttpResponseRedirect(reverse('login') + '?next=' + request.path)
|
||||
return HttpResponseRedirect(reverse('account_login') + '?next=' + request.path)
|
||||
|
||||
comments = Comment.objects.filter(recipe=recipe)
|
||||
|
||||
@ -377,7 +377,7 @@ def setup(request):
|
||||
messages.ERROR,
|
||||
_('The setup page can only be used to create the first user! If you have forgotten your superuser credentials please consult the django documentation on how to reset passwords.') # noqa: E501
|
||||
)
|
||||
return HttpResponseRedirect(reverse('login'))
|
||||
return HttpResponseRedirect(reverse('account_login'))
|
||||
|
||||
if request.method == 'POST':
|
||||
form = UserCreateForm(request.POST)
|
||||
@ -399,7 +399,7 @@ def setup(request):
|
||||
messages.SUCCESS,
|
||||
_('User has been created, please login!')
|
||||
)
|
||||
return HttpResponseRedirect(reverse('login'))
|
||||
return HttpResponseRedirect(reverse('account_login'))
|
||||
except ValidationError as e:
|
||||
for m in e:
|
||||
form.add_error('password', m)
|
||||
@ -450,7 +450,7 @@ def signup(request, token):
|
||||
link.used_by = user
|
||||
link.save()
|
||||
user.groups.add(link.group)
|
||||
return HttpResponseRedirect(reverse('login'))
|
||||
return HttpResponseRedirect(reverse('account_login'))
|
||||
except ValidationError as e:
|
||||
for m in e:
|
||||
form.add_error('password', m)
|
||||
|
@ -27,6 +27,9 @@ DEMO = bool(int(os.getenv('DEMO', False)))
|
||||
|
||||
INTERNAL_IPS = os.getenv('INTERNAL_IPS').split(',') if os.getenv('INTERNAL_IPS') else ['127.0.0.1']
|
||||
|
||||
# django allauth site id
|
||||
SITE_ID = int(os.getenv('ALLAUTH_SITE_ID', 1))
|
||||
|
||||
# allow djangos wsgi server to server mediafiles
|
||||
GUNICORN_MEDIA = bool(int(os.getenv('GUNICORN_MEDIA', True)))
|
||||
|
||||
@ -68,6 +71,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.staticfiles',
|
||||
'django_tables2',
|
||||
'django_filters',
|
||||
@ -78,6 +82,10 @@ INSTALLED_APPS = [
|
||||
'django_cleanup.apps.CleanupConfig',
|
||||
'webpack_loader',
|
||||
'django_js_reverse',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'allauth.socialaccount',
|
||||
'allauth.socialaccount.providers.github',
|
||||
'cookbook.apps.CookbookConfig',
|
||||
]
|
||||
|
||||
@ -95,6 +103,7 @@ MIDDLEWARE = [
|
||||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
]
|
||||
|
||||
if REVERSE_PROXY_AUTH:
|
||||
|
@ -25,7 +25,7 @@ from django_js_reverse import views as reverse_views
|
||||
urlpatterns = [
|
||||
path('', include('cookbook.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
path('accounts/', include('allauth.urls')),
|
||||
path('i18n/', include('django.conf.urls.i18n')),
|
||||
path(
|
||||
'jsi18n/',
|
||||
|
@ -31,3 +31,4 @@ Jinja2==2.11.2
|
||||
django-webpack-loader==0.7.0
|
||||
django-js-reverse==0.9.1
|
||||
pre-commit==2.9.3
|
||||
django-allauth==0.44.0
|
Loading…
Reference in New Issue
Block a user