<!-- Note: This file is primarily defined to be used in the IXP documentation. However, it is also provided in the docker-deployment repository for reference. If you accessed this file from the docker-deployment repository, please be aware that the links used in this file may not work as expected. -->

## Initial user creation

The INJECT Exercise Platform does not generate any default admin account that
you may use to log in and manage the platform.

There are currently two ways to create an admin account, both of which require
direct access to the backend docker container.

To enter the container, run the following command:

```
docker compose exec -it backend /bin/sh
```

### Management Command

!!! Disclaimer

    This option REQUIRES SMTP to be set up.

In the docker container, run:

```
python manage.py initadmins <comma-separated list of emails>
```

This command will create an admin account for each email address in the list and
send the login credentials to that address.

Example:

```
python manage.py initadmins jane.doe@mail.com,john.doe@mail.com
```

### Django Shell

If you don't have SMTP set up, this is the only option for creating admin
accounts.

In the docker container, run these commands:

```
python manage.py shell
from user.models import User

User(group=User.AuthGroup.ADMIN).set_email_username("email@test.com").set_password("long_and_secure_password").save()
```

Replace `email@test.com` and `long_and_secure_password` with your desired admin
credentials.

After executing the above commands, you can log in to the platform using the
provided credentials.

### Conclusion

If you need to create additional users, please refer to the
[User Onboarding](./../security.md#user-onboarding) page.

<div class="navigation" markdown>
 [&larr; Installation overview](overview.md){ .md-button }
</div>
