From 8658ba0c9fb45ad77496086223f9f561cfeb5f2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Juh=C3=A1s?= <xjuhas@fi.muni.cz>
Date: Sat, 8 Feb 2025 16:50:35 +0100
Subject: [PATCH] * update users.md

---
 docs/tech/installation/users.md | 50 +++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/docs/tech/installation/users.md b/docs/tech/installation/users.md
index dd511ee..aeaee7a 100644
--- a/docs/tech/installation/users.md
+++ b/docs/tech/installation/users.md
@@ -1,34 +1,48 @@
 ## Initial user creation
 
-INJECT Exercise Platform without prior setup does not generate any standard admin user, that you may use to login and manage the platform.
+INJECT Exercise Platform without prior setup does not generate any standard admin user,
+that you may use to log in and manage the platform.
 
-There are currently two ways how you may generate said Admin user.
+There are currently two ways how you may generate said Admin user,
+both of which require direct access to the backend docker container.
 
-### Direct creation via Docker
+To enter the container, run the following command:
+```
+docker compose exec -it backend /bin/sh
+```
 
-After launching the deployment, please wait for all migrations to finish and execute following command. Navigate your shell to the folder of your Docker compose configuration directly and
+### Management command
 
-- Execute a shell session in the backend container, please make sure to navigate your shell to the folder where your Docker compose resides at
+**This option REQUIRES SMTP to be set up.**
 
-    ```
-    docker compose exec backend python manage.py shell
-    ```
+In the docker container, run:
+```
+python manage.py initadmins <comma-separated list of emails>
+```
 
-- Create a admin using the Django shell. Replace `email@test.com` and `long_and_secure_password` with your desired admin credentials.:
+This command will create an admin account for each email address in the list
+and send the login credentials to that address.
 
-    ``` python
-    from user.models import User
-    User.objects.create_superuser(username="email@test.com", password="long_and_secure_password")
-    ```
+Example:
+```
+python manage.py initadmins jane.doe@mail.com,john.doe@mail.com
+```
 
-- These steps may be further simplified/automized by merging both of these commands accordingly
+### Django shell
 
-    ```
-    docker compose exec backend python manage.py shell -c "from user.models import User; User.objects.create_superuser(username="email@test.com", password="long_and_secure_password");"
-    ```
+This is the only option to create admin users without SMTP.
 
-After creation of the user, you may login into the IXP.
+In the docker container, run these commands:
+```
+python manage.py shell
+from user.models import User
 
+User.objects.create_superuser(username="email@test.com", password="long_and_secure_password")
+```
+
+Replace `email@test.com` and `long_and_secure_password` with your desired admin credentials.
+
+After creation of the user, you may log in into the IXP.
 
 If you need to create normal users, then please refer to the [User Onboarding](./../security.md#user-onboarding).
 
-- 
GitLab