From 1f138f096c331114b1f846811ccbb650860f8351 Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Tue, 18 Jun 2024 15:49:56 -0500
Subject: [PATCH 1/9] Adds string requesting to user to lot in with existing
username or create new account
---
kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue b/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue
index 19fbf58fe2..f341dbb95f 100644
--- a/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue
+++ b/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue
@@ -332,6 +332,11 @@
context:
'Link to open the Kolibri usage and privacy modal. It will be displayed alongside the text describing collection of demographic user information.',
},
+ /* eslint-disable kolibri/vue-no-unused-translations */
+ SignInOrCreateAccount: {
+ message: 'Sign in as {username} or start over and create a new account.',
+ context: 'Message prompting user to sign in with existing username or create new account.',
+ },
},
};
From 02aaf1bcb1809d18c3b7c6512de922e767169ad8 Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Wed, 19 Jun 2024 14:04:39 -0500
Subject: [PATCH 2/9] Update string and link to prompt users to sign in with
existing username
---
.../onboarding-forms/UserCredentialsForm.vue | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
index 4faaf9a9b2..fe0738c504 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
@@ -42,6 +42,14 @@
:isUniqueValidator="!selectedUser ? uniqueUsernameValidator : () => true"
/>
+
+
From b8d7315e9d9d392d1097af552036cb430835977b Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Tue, 18 Jun 2024 15:49:56 -0500
Subject: [PATCH 3/9] Adds string requesting to user to lot in with existing
username or create new account
---
kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue b/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue
index 2329530624..3c9dedfbad 100644
--- a/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue
+++ b/kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue
@@ -333,6 +333,11 @@
context:
'Link to open the Kolibri usage and privacy modal. It will be displayed alongside the text describing collection of demographic user information.',
},
+ /* eslint-disable kolibri/vue-no-unused-translations */
+ SignInOrCreateAccount: {
+ message: 'Sign in as {username} or start over and create a new account.',
+ context: 'Message prompting user to sign in with existing username or create new account.',
+ },
},
};
From 3df4723e176ad4ff285c49a033234e774b89e28b Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Wed, 19 Jun 2024 14:04:39 -0500
Subject: [PATCH 4/9] Update string and link to prompt users to sign in with
existing username
---
.../onboarding-forms/UserCredentialsForm.vue | 23 ++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
index 76fcd5a07b..dff28f1a82 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
@@ -42,6 +42,14 @@
:isUniqueValidator="!selectedUser ? uniqueUsernameValidator : () => true"
/>
+
+
From 1580291d9b3659a7721e8d872a2ed3726d995782 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Mon, 24 Jun 2024 16:03:30 +0000
Subject: [PATCH 5/9] [pre-commit.ci lite] apply automatic fixes
---
.../onboarding-forms/UserCredentialsForm.vue | 441 +++++++++---------
1 file changed, 217 insertions(+), 224 deletions(-)
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
index 2c9d179209..1623d65d0b 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
@@ -1,5 +1,4 @@
-
-
-
-
From 289b4f3edd2cc5aedc8622e6de28032f1e37fb4c Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Mon, 24 Jun 2024 11:13:39 -0500
Subject: [PATCH 6/9] Manage redirection with state machine
---
.../assets/src/machines/wizardMachine.js | 4 ++++
.../assets/src/views/LodJoinFacility.vue | 15 ++++++++++++++-
.../onboarding-forms/UserCredentialsForm.vue | 18 ++++++------------
3 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/kolibri/plugins/setup_wizard/assets/src/machines/wizardMachine.js b/kolibri/plugins/setup_wizard/assets/src/machines/wizardMachine.js
index e065e320ce..549517da65 100644
--- a/kolibri/plugins/setup_wizard/assets/src/machines/wizardMachine.js
+++ b/kolibri/plugins/setup_wizard/assets/src/machines/wizardMachine.js
@@ -398,6 +398,10 @@ export const wizardMachine = createMachine(
on: {
BACK: 'selectLodSetupType',
CONTINUE: 'lodJoinLoading',
+ SIGN_IN_INSTEAD: {
+ target: 'lodProceedJoinOrNew',
+ actions: ['setLodType', 'setSelectedImportDeviceFacility'],
+ },
},
},
},
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/LodJoinFacility.vue b/kolibri/plugins/setup_wizard/assets/src/views/LodJoinFacility.vue
index 155c1f5fe4..6f0cd01f02 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/LodJoinFacility.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/LodJoinFacility.vue
@@ -12,6 +12,7 @@
:noBackAction="false"
:errors.sync="caughtErrors"
@submit="handleClickNext"
+ @signInInstead="goToSignIn"
/>
@@ -24,7 +25,7 @@
import { ERROR_CONSTANTS } from 'kolibri.coreVue.vuex.constants';
import commonSyncElements from 'kolibri.coreVue.mixins.commonSyncElements';
import { SetupWizardResource } from '../api';
- import { FooterMessageTypes } from '../constants';
+ import { FooterMessageTypes, LodTypePresets as Options } from '../constants';
import UserCredentialsForm from './onboarding-forms/UserCredentialsForm';
export default {
@@ -90,6 +91,18 @@
}
});
},
+ goToSignIn() {
+ this.wizardService.send({
+ type: 'SIGN_IN_INSTEAD',
+ value: {
+ importDeviceId: this.wizardService.state.context.importDeviceId,
+ importOrJoin: Options.IMPORT,
+ selectedFacility: this.facility,
+ importDevice: this.wizardService.state.context.importDevice,
+ facilitiesCount: this.wizardService.state.context.facilitiesOnDeviceCount,
+ },
+ });
+ },
},
$trs: {
header: {
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
index 48b813a295..b3e72c410f 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
@@ -41,12 +41,12 @@
:isUniqueValidator="!selectedUser ? uniqueUsernameValidator : () => true"
/>
-
Date: Mon, 24 Jun 2024 11:26:59 -0500
Subject: [PATCH 7/9] Remove duplicate import
---
.../src/views/onboarding-forms/UserCredentialsForm.vue | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
index b3e72c410f..d2c6c85185 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
@@ -1,4 +1,5 @@
+
+
+
+
From 15bd377471b89c83f9bcc8a38390ef853cf557f5 Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Wed, 26 Jun 2024 08:44:01 -0500
Subject: [PATCH 8/9] Update and remove unused sign in string
---
.../src/views/onboarding-forms/UserCredentialsForm.vue | 4 ++--
kolibri/plugins/user_auth/assets/src/views/SignUpPage.vue | 5 -----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
index d2c6c85185..85af75d837 100644
--- a/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
+++ b/kolibri/plugins/setup_wizard/assets/src/views/onboarding-forms/UserCredentialsForm.vue
@@ -44,7 +44,7 @@
Date: Mon, 1 Jul 2024 11:03:52 -0500
Subject: [PATCH 9/9] Modify sign up viewsets to ensure exclusion of CSRF
protection for public signups
---
kolibri/core/auth/api.py | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/kolibri/core/auth/api.py b/kolibri/core/auth/api.py
index 4bef4681f3..f26f944d46 100644
--- a/kolibri/core/auth/api.py
+++ b/kolibri/core/auth/api.py
@@ -779,12 +779,13 @@ def annotate_queryset(self, queryset):
return annotate_array_aggregate(queryset, user_ids="membership__user__id")
-@method_decorator(csrf_protect, name="dispatch")
-class SignUpViewSet(viewsets.GenericViewSet, CreateModelMixin):
-
+class BaseSignUpViewSet(viewsets.GenericViewSet, CreateModelMixin):
serializer_class = FacilityUserSerializer
def check_can_signup(self, serializer):
+ """
+ Check if the user can sign up to the specified facility.
+ """
facility = serializer.validated_data["facility"]
if (
not facility.dataset.learner_can_sign_up
@@ -793,6 +794,9 @@ def check_can_signup(self, serializer):
raise PermissionDenied("Cannot sign up to this facility")
def perform_create(self, serializer):
+ """
+ Handle the creation of a new user, including validation and logging in.
+ """
self.check_can_signup(serializer)
serializer.save()
data = serializer.validated_data
@@ -804,8 +808,17 @@ def perform_create(self, serializer):
login(self.request, authenticated_user)
+@method_decorator(csrf_protect, name="dispatch")
+class SignUpViewSet(BaseSignUpViewSet):
+ """
+ Viewset for signing up a user with CSRF protection.
+ """
+
+ pass
+
+
@method_decorator(csrf_exempt, name="dispatch")
-class PublicSignUpViewSet(SignUpViewSet):
+class PublicSignUpViewSet(BaseSignUpViewSet):
"""
Identical to the SignUpViewset except that it does not login the user.
This endpoint is intended to allow a FacilityUser in a different facility