From 0c8e419b4e15b8076ed23d18d9160de1d67b47c7 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Wed, 22 May 2024 15:25:21 -0700 Subject: [PATCH] Handle case when username doesn't exist on remote and try to create it. --- kolibri/plugins/user_profile/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kolibri/plugins/user_profile/tasks.py b/kolibri/plugins/user_profile/tasks.py index c16d84422d5..551f35805eb 100644 --- a/kolibri/plugins/user_profile/tasks.py +++ b/kolibri/plugins/user_profile/tasks.py @@ -45,7 +45,10 @@ def validate(self, data): details = e.detail if isinstance(e.detail, list) else [e.detail] for detail in details: # If any of the errors are authentication related, then we need to create the user - if detail.code == error_constants.AUTHENTICATION_FAILED: + if ( + detail.code == error_constants.AUTHENTICATION_FAILED + or detail.code == error_constants.INVALID_USERNAME + ): self.create_remote_user(data) job_data = super(MergeUserValidator, self).validate(data) break