Repository: learningequality/kolibri

Issue:
[Follow-up issue] Setup Wizard - Validation messages at 'Import individual user accounts' and 'Use an admin account'
## Observed behavior
While regression testing https://github.com/learningequality/kolibri/pull/11704 I noticed the following additional minor validation related issues:

- there's no error message displayed if the user attempts to submit an empty form (that's valid both at 'Import individual user accounts' and 'Use an admin account')
- when we have only the 'Username' field being displayed and I enter an admin username then I am still seeing the "Incorrect username or password" - I think in that case we should be showing the `Device limitations` modal, the same as when the Password field is visible
- if after seeing the "Incorrect username or password" message I click the `Use an admin account` link then the "Incorrect username or password" message is still being displayed above the empty form for the admin credentials
- when we have both the Username and Password fields displayed and I enter the username of a learner who was originally created without a password then it's not accepted as valid credentials and I have to import that learner signed in as an admin. This is probably OK, but just mentioning it here as an edge case in case that could be considered.

## Expected behavior

The issues should be further discussed and either fixed with separate PRs or disregarded.

## Steps to reproduce the issue

1. Install the [latest Beta 10 build asset](https://github.com/learningequality/kolibri/releases/tag/v0.16.0-beta10).
2. In the setup wizard go through Group learning > Learn-only device > Import one or more existing user accounts from an existing facility
3. At the Import individual user accounts you will either see only the 'Username' field or both the 'Username' and 'Password' fields if the option 'Require passwords for learners' checkbox is selected at Device > Settings on the server.

## Usage Details
[Beta 10](https://github.com/learningequality/kolibri/releases/tag/v0.16.0-beta10)
Ubuntu 22  - Chrome


Discussion:
@marcellamaki 
If all the above-mentioned issues are available for assignment, I would like to work on them. @MisRob
Hi @GarvitSinghal47, thank you for volunteering here. This one is assigned to @jredrejo already.

Resolving patch:
diff --git a/kolibri/plugins/setup_wizard/api.py b/kolibri/plugins/setup_wizard/api.py
--- a/kolibri/plugins/setup_wizard/api.py
+++ b/kolibri/plugins/setup_wizard/api.py
@@ -1,6 +1,7 @@
 import requests
 from django.urls import reverse
 from rest_framework import decorators
+from rest_framework.exceptions import AuthenticationFailed
 from rest_framework.exceptions import NotFound
 from rest_framework.exceptions import PermissionDenied
 from rest_framework.exceptions import ValidationError
@@ -154,7 +155,12 @@ def listfacilitylearners(self, request):
         baseurl = request.data.get("baseurl")
         password = request.data.get("password")
         username = request.data.get("username")
-        facility_info = get_remote_users_info(baseurl, facility_id, username, password)
+        try:
+            facility_info = get_remote_users_info(
+                baseurl, facility_id, username, password
+            )
+        except AuthenticationFailed:
+            raise PermissionDenied()
         user_info = facility_info["user"]
         roles = user_info["roles"]
         admin_roles = (user_kinds.ADMIN, user_kinds.SUPERUSER)


Test patch: