From 273894f92a60bf90eb0aaa256f55de89237519f4 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 7 Jan 2025 16:58:49 -0800 Subject: [PATCH 1/9] Add "terms" option to AboutFAQ model & migration --- .../migrations/0006_alter_aboutfaq_kind.py | 18 ++++++++++++++++++ kolibri_instant_schools_plugin/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 kolibri_instant_schools_plugin/migrations/0006_alter_aboutfaq_kind.py diff --git a/kolibri_instant_schools_plugin/migrations/0006_alter_aboutfaq_kind.py b/kolibri_instant_schools_plugin/migrations/0006_alter_aboutfaq_kind.py new file mode 100644 index 0000000..cd8aee1 --- /dev/null +++ b/kolibri_instant_schools_plugin/migrations/0006_alter_aboutfaq_kind.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.25 on 2025-01-08 00:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kolibri_instant_schools_plugin', '0005_aboutfaq'), + ] + + operations = [ + migrations.AlterField( + model_name='aboutfaq', + name='kind', + field=models.TextField(choices=[('FAQ', 'FAQ'), ('About', 'About'), ('Terms', 'Terms')]), + ), + ] diff --git a/kolibri_instant_schools_plugin/models.py b/kolibri_instant_schools_plugin/models.py index b52aa86..7646a86 100644 --- a/kolibri_instant_schools_plugin/models.py +++ b/kolibri_instant_schools_plugin/models.py @@ -11,7 +11,7 @@ class AboutFAQ(models.Model): html = models.TextField() - kind = models.TextField(choices=(("FAQ", "FAQ"), ("About", "About"))) + kind = models.TextField(choices=(("FAQ", "FAQ"), ("About", "About"), ("Terms", "Terms"))) class Meta: app_label = "kolibri_instant_schools_plugin" From e6efc74e735a8b303453258828334c93e20d4d7f Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 7 Jan 2025 16:59:34 -0800 Subject: [PATCH 2/9] use the terms API endpoint for TOS iframe src; use KModal API for cleaner UI --- .../assets/src/views/SignUpPage.vue | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/kolibri_instant_schools_plugin/assets/src/views/SignUpPage.vue b/kolibri_instant_schools_plugin/assets/src/views/SignUpPage.vue index c1b64e0..c253bd4 100644 --- a/kolibri_instant_schools_plugin/assets/src/views/SignUpPage.vue +++ b/kolibri_instant_schools_plugin/assets/src/views/SignUpPage.vue @@ -110,18 +110,13 @@ v-if="showTerms" :title="$tr('termsOfServiceModalHeader')" :size="'large'" + :cancelText="$tr('close')" @cancel="showTerms = false" > - From 2676beb6f030e18b3cfbfab222b5fb1b00555472 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 7 Jan 2025 17:31:15 -0800 Subject: [PATCH 3/9] PhoneNumberSignupSerializer is only used when handling a SignUp, so create the username mapping when the given username is validated --- kolibri_instant_schools_plugin/auth/api.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/kolibri_instant_schools_plugin/auth/api.py b/kolibri_instant_schools_plugin/auth/api.py index 5e43f67..d952e03 100644 --- a/kolibri_instant_schools_plugin/auth/api.py +++ b/kolibri_instant_schools_plugin/auth/api.py @@ -37,26 +37,13 @@ def validate_username(self, value): _('An account already exists for this phone number. To add a new profile ' + 'under this account, you must first login. If you have forgotten your ' + 'password, you can reset it using the link on the login page.')) - return value + return create_new_username(value) class PhoneNumberSignUpViewSet(SignUpViewSet): serializer_class = PhoneNumberSignupSerializer - def extract_request_data(self, request): - data = super(PhoneNumberSignUpViewSet, self).extract_request_data(request) - - # if there are already users for this number, use one, to trigger a validation error, else create a new one - usernames = get_usernames(hash_phone(data["username"])) - if usernames: - data["username"] = hash_phone(usernames[0]) - else: - data["username"] = create_new_username(data["username"]) - - return data - - class PasswordResetTokenViewset(viewsets.ViewSet): def create(self, request): From dc40f93351edf84e2dbb4030250434ff97b0a72a Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Wed, 8 Jan 2025 11:28:51 -0800 Subject: [PATCH 4/9] include missing AppBarPage import --- .../assets/src/views/SelectProfilePage/index.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kolibri_instant_schools_plugin/assets/src/views/SelectProfilePage/index.vue b/kolibri_instant_schools_plugin/assets/src/views/SelectProfilePage/index.vue index f97c6fc..6809188 100644 --- a/kolibri_instant_schools_plugin/assets/src/views/SelectProfilePage/index.vue +++ b/kolibri_instant_schools_plugin/assets/src/views/SelectProfilePage/index.vue @@ -39,6 +39,7 @@