allauth working and integrated

This commit is contained in:
vabene1111
2021-01-28 13:40:07 +01:00
parent 53c715b6f6
commit 63cfa14a21
12 changed files with 162 additions and 87 deletions

View File

@@ -9,7 +9,11 @@ class AllAuthCustomAdapter(DefaultAccountAdapter):
"""
Whether to allow sign ups.
"""
allow_signups = super(
AllAuthCustomAdapter, self).is_open_for_signup(request)
# Override with setting, otherwise default to super.
return getattr(settings, 'ACCOUNT_ALLOW_SIGNUPS', allow_signups)
if request.resolver_match.view_name == 'account_signup':
return False
else:
return super(AllAuthCustomAdapter, self).is_open_for_signup(request)
# disable password reset for now
def send_mail(self, template_prefix, email, context):
pass

View File

@@ -119,7 +119,7 @@ def group_required(*groups_required):
def in_groups(u):
return has_group_permission(u, groups_required)
return user_passes_test(in_groups)
return user_passes_test(in_groups, login_url='view_no_group')
class GroupRequiredMixin(object):
@@ -138,8 +138,7 @@ class GroupRequiredMixin(object):
)
return HttpResponseRedirect(reverse_lazy('index'))
return super(GroupRequiredMixin, self) \
.dispatch(request, *args, **kwargs)
return super(GroupRequiredMixin, self).dispatch(request, *args, **kwargs)
class OwnerRequiredMixin(object):