From 936535fef24ddcffd301239e030d5f900563e27a Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Thu, 16 Nov 2023 16:27:27 +0530 Subject: [PATCH 1/2] dev: instance admin unique constraints --- ...002_alter_instanceadmin_unique_together.py | 19 +++++++++++++++++++ apiserver/plane/license/models/instance.py | 1 + 2 files changed, 20 insertions(+) create mode 100644 apiserver/plane/license/migrations/0002_alter_instanceadmin_unique_together.py diff --git a/apiserver/plane/license/migrations/0002_alter_instanceadmin_unique_together.py b/apiserver/plane/license/migrations/0002_alter_instanceadmin_unique_together.py new file mode 100644 index 000000000..21d4baaf1 --- /dev/null +++ b/apiserver/plane/license/migrations/0002_alter_instanceadmin_unique_together.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.5 on 2023-11-16 09:45 + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('license', '0001_initial'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='instanceadmin', + unique_together={('instance', 'user')}, + ), + ] diff --git a/apiserver/plane/license/models/instance.py b/apiserver/plane/license/models/instance.py index 78da706af..5f96b6b90 100644 --- a/apiserver/plane/license/models/instance.py +++ b/apiserver/plane/license/models/instance.py @@ -53,6 +53,7 @@ class InstanceAdmin(BaseModel): role = models.PositiveIntegerField(choices=ROLE_CHOICES, default=15) class Meta: + unique_together = ["instance", "user"] verbose_name = "Instance Admin" verbose_name_plural = "Instance Admins" db_table = "instance_admins" From 3f2b890a48a7b9fc4325a1aec8ad0d900d7b9e66 Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Thu, 16 Nov 2023 16:40:16 +0530 Subject: [PATCH 2/2] dev: check magic link login --- apiserver/plane/bgtasks/magic_link_code_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiserver/plane/bgtasks/magic_link_code_task.py b/apiserver/plane/bgtasks/magic_link_code_task.py index 8d64029ee..372cafa6e 100644 --- a/apiserver/plane/bgtasks/magic_link_code_task.py +++ b/apiserver/plane/bgtasks/magic_link_code_task.py @@ -33,8 +33,8 @@ def magic_link(email, key, token, current_site): username=get_configuration_value(instance_configuration, "EMAIL_HOST_USER"), password=get_configuration_value(instance_configuration, "EMAIL_HOST_PASSWORD"), use_tls=bool(get_configuration_value(instance_configuration, "EMAIL_USE_TLS", "1")), - use_ssl=bool(get_configuration_value(instance_configuration, "EMAIL_USE_SSL", "0")), ) + # Initiate email alternatives msg = EmailMultiAlternatives(subject=subject, body=text_content, from_email=get_configuration_value(instance_configuration, "EMAIL_FROM"), to=[email], connection=connection) msg.attach_alternative(html_content, "text/html")