Merge pull request 'Bugfixes: Redirect URI protocol, org create' (#25) from bugfixes into main
Reviewed-on: https://servala-2nkgm.app.codey.ch/servala/servala-portal/pulls/25
This commit is contained in:
commit
4cd5653b99
3 changed files with 10 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -167,3 +167,5 @@ deployment/secrets/*
|
|||
|
||||
# Various local folders
|
||||
tmp/
|
||||
static.dist/
|
||||
media/
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.db import models
|
|||
from django.utils.functional import cached_property
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_scopes import ScopedManager
|
||||
from django_scopes import ScopedManager, scopes_disabled
|
||||
|
||||
from servala.core import rules as perms
|
||||
from servala.core.models.mixins import ServalaModelMixin
|
||||
|
@ -47,10 +47,11 @@ class Organization(ServalaModelMixin, models.Model):
|
|||
return self.urls.base
|
||||
|
||||
def set_owner(self, user):
|
||||
OrganizationMembership.objects.filter(user=user, organization=self).delete()
|
||||
OrganizationMembership.objects.create(
|
||||
user=user, organization=self, role=OrganizationRole.OWNER
|
||||
)
|
||||
with scopes_disabled():
|
||||
OrganizationMembership.objects.filter(user=user, organization=self).delete()
|
||||
OrganizationMembership.objects.create(
|
||||
user=user, organization=self, role=OrganizationRole.OWNER
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create_organization(cls, instance, owner):
|
||||
|
|
|
@ -174,6 +174,8 @@ ACCOUNT_UNIQUE_EMAIL = True
|
|||
ACCOUNT_LOGIN_METHODS = {"email"}
|
||||
ACCOUNT_SIGNUP_FIELDS = ["email*", "password1*", "password2*"]
|
||||
ACCOUNT_SIGNUP_FORM_CLASS = "servala.frontend.forms.auth.ServalaSignupForm"
|
||||
if ALLOWED_HOSTS or not DEBUG:
|
||||
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
|
||||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
"rules.permissions.ObjectPermissionBackend",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue