Skip to content

Commit 6793f8b

Browse files
authored
Document how to create the first admin with third-party auth (#4657)
1 parent 66472fd commit 6793f8b

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

‎documentation/docs/dev/deployment.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ applied per authenticated user. Uses the Django REST Framework format
4242
`day` (default: `180/hour`).
4343

4444
`AUTHENTICATION_METHOD`
45-
The default value is `django`, which allows you to log in via accounts created using `manage.py shell`.
45+
The default value is `django`, which allows you to log in via accounts created using `manage.py createsuperuser`.
4646
See [Authentication provider configuration](#authentication-provider-configuration)
4747
for more information about third-party authentication methods.
4848

@@ -408,6 +408,27 @@ To use Keycloak authentication (`AUTHENTICATION_METHOD=keycloak`):
408408
- `KEYCLOAK_CLIENT_SECRET`
409409
- `KEYCLOAK_CLIENT_URL`
410410

411+
### Creating the first admin account
412+
413+
With a third-party authentication method, every account is created on first
414+
login through the provider, so there is no admin account to start with. To
415+
make your own account an admin:
416+
417+
1. Log in to Pontoon once with the provider, so that your account exists.
418+
2. Open a shell on the server and run the following command using the email
419+
address your provider account logs in with:
420+
421+
```sh
422+
./manage.py shell -c "from django.contrib.auth.models import User; print(User.objects.filter(email='you@example.com').update(is_superuser=True, is_staff=True))"
423+
```
424+
425+
It should print `1`. If it prints `0`, no account with that email exists
426+
yet.
427+
428+
`is_superuser` grants all permissions in Pontoon, including the admin pages
429+
under `/admin/`, and `is_staff` is what grants access to the Django admin at
430+
`/a/`.
431+
411432
## Scheduled Jobs
412433

413434
Pontoon requires several scheduled jobs to run regularly.

0 commit comments

Comments
 (0)