Bugfixes: Redirect URI protocol, org create #25

Merged
rixx merged 3 commits from bugfixes into main 2025-03-24 10:39:47 +00:00
3 changed files with 10 additions and 5 deletions

2
.gitignore vendored
View file

@ -167,3 +167,5 @@ deployment/secrets/*
# Various local folders
tmp/
static.dist/
media/

View file

@ -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):

View file

@ -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",