From 85fb8f4d07806952fc71d16d98f7ac3e66a0c530 Mon Sep 17 00:00:00 2001 From: ddahan Date: Thu, 28 Mar 2024 13:46:45 +0000 Subject: [PATCH 1/2] bug fix --- data/models/user.py | 2 ++ frontend/src/views/LoginPage.vue | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/models/user.py b/data/models/user.py index 33515a74..253d0948 100644 --- a/data/models/user.py +++ b/data/models/user.py @@ -37,6 +37,7 @@ def create_user(self, email, password=None, **extra_fields): def create_superuser(self, email, password, **extra_fields): user = self.create_user(email, password, **extra_fields) + user.is_verified = True user.is_staff = True user.is_superuser = True user.save(using=self._db) @@ -44,6 +45,7 @@ def create_superuser(self, email, password, **extra_fields): def create_staffuser(self, email, password, **extra_fields): user = self.create_user(email, password, **extra_fields) + user.is_verified = True user.is_staff = True user.save(using=self._db) return user diff --git a/frontend/src/views/LoginPage.vue b/frontend/src/views/LoginPage.vue index d85fd729..da53505f 100644 --- a/frontend/src/views/LoginPage.vue +++ b/frontend/src/views/LoginPage.vue @@ -92,7 +92,7 @@ const submit = async () => { // Give the ability to ask for a new e-email, only if the user is not verified yet. // ⛔️ TODO: change this dirty hack: we use error message until having appropriate error codes in responses - if ($externalResults.value.nonFieldErrors[0].includes("vérifié")) { + if ($externalResults.value?.nonFieldErrors[0].includes("vérifié")) { showSendNewConfirmationMail.value = true userIdForNewConfirmationMail.value = $externalResults.value.extra.userId } From 34b0fac0edb01c1955883d74cdcc4ee3c87da288 Mon Sep 17 00:00:00 2001 From: Alejandro MG Date: Thu, 28 Mar 2024 17:51:55 +0100 Subject: [PATCH 2/2] Takes into account empty arrays --- frontend/src/views/LoginPage.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/LoginPage.vue b/frontend/src/views/LoginPage.vue index da53505f..f2d223bc 100644 --- a/frontend/src/views/LoginPage.vue +++ b/frontend/src/views/LoginPage.vue @@ -92,7 +92,7 @@ const submit = async () => { // Give the ability to ask for a new e-email, only if the user is not verified yet. // ⛔️ TODO: change this dirty hack: we use error message until having appropriate error codes in responses - if ($externalResults.value?.nonFieldErrors[0].includes("vérifié")) { + if ($externalResults.value?.nonFieldErrors?.[0]?.includes("vérifié")) { showSendNewConfirmationMail.value = true userIdForNewConfirmationMail.value = $externalResults.value.extra.userId }