added default space/group for o auth signup
This commit is contained in:
parent
8b0f9bc2e7
commit
c5d509bf9e
@ -58,3 +58,10 @@ REVERSE_PROXY_AUTH=0
|
||||
# see docs for more information https://vabene1111.github.io/recipes/features/authentication/
|
||||
# SOCIAL_PROVIDERS = allauth.socialaccount.providers.github, allauth.socialaccount.providers.nextcloud,
|
||||
|
||||
# Should a newly created user from a social provider get assigned to the default space and given permission by default ?
|
||||
# ATTENTION: This feature might be deprecated in favor of a space join and public viewing system in the future
|
||||
# default 0 (false), when 1 (true) users will be assigned space and group
|
||||
# SOCIAL_DEFAULT_ACCESS = 1
|
||||
|
||||
# if SOCIAL_DEFAULT_ACCESS is used, which group should be added
|
||||
# SOCIAL_DEFAULT_GROUP=guest
|
@ -90,6 +90,11 @@ def no_groups(request):
|
||||
|
||||
|
||||
def no_space(request):
|
||||
if settings.SOCIAL_DEFAULT_ACCESS:
|
||||
request.user.userpreference.space = Space.objects.first()
|
||||
request.user.userpreference.save()
|
||||
request.user.groups.add(Group.objects.get(name=settings.SOCIAL_DEFAULT_GROUP))
|
||||
return HttpResponseRedirect(reverse('index'))
|
||||
return render(request, 'no_space_info.html')
|
||||
|
||||
|
||||
|
@ -26,6 +26,10 @@ SECRET_KEY = os.getenv('SECRET_KEY') if os.getenv('SECRET_KEY') else 'INSECURE_S
|
||||
DEBUG = bool(int(os.getenv('DEBUG', True)))
|
||||
DEMO = bool(int(os.getenv('DEMO', False)))
|
||||
|
||||
SOCIAL_DEFAULT_ACCESS = bool(int(os.getenv('SOCIAL_DEFAULT_ACCESS', False)))
|
||||
SOCIAL_DEFAULT_GROUP = os.getenv('SOCIAL_DEFAULT_GROUP', 'guest')
|
||||
|
||||
|
||||
INTERNAL_IPS = os.getenv('INTERNAL_IPS').split(',') if os.getenv('INTERNAL_IPS') else ['127.0.0.1']
|
||||
|
||||
# allow djangos wsgi server to server mediafiles
|
||||
|
Loading…
Reference in New Issue
Block a user