Skip to content

Commit

Permalink
fix: 💄 use alerts instead of modal for expert form submission
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Sep 12, 2024
1 parent 00a3d09 commit 714487f
Show file tree
Hide file tree
Showing 7 changed files with 5,301 additions and 6,314 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ make up
# stop
make down
```

### Authentication

1. Login into keycloak
2. Go to the Basegun realm
3. Then in "Realm settings", go to "Keys"
4. Copy the RS256 public key and paste it in the docker compose.

## Debugging

* If the interface of the website does not appear on localhost:3000, there is an issue with frontend. In terminal, run `docker logs basegun-frontend`
Expand Down
9 changes: 5 additions & 4 deletions backend/src/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,15 @@ async def expert_contact(
email: Annotated[str, Form()],
seizure: Annotated[str, Form()],
una_or_procedure_number: Annotated[str, Form()],
gun_type: Annotated[str, Form()],
gun_length: Annotated[int | None, Form()],
gun_barrel_length: Annotated[int | None, Form()],
markings_description: Annotated[str | None, Form()],
files: Annotated[
list[UploadFile], File(description="Multiple files as UploadFile")
],
current_user: Annotated[dict, Depends(get_current_user)],
# Optionnal fields
markings_description: Annotated[str, Form()] = None,
gun_type: Annotated[str, Form()] = None,
gun_barrel_length: Annotated[int, Form()] = None,
gun_length: Annotated[int, Form()] = None,
):
await send_mail(
subject="[Basegun] Demande d'identification",
Expand Down
5 changes: 2 additions & 3 deletions backend/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

client = TestClient(app)

token = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJFYUxsTVlreWVOal93M19Ub0phajZ1OWdQc241M1dtM1JTQkNPeFdjdnVrIn0.eyJleHAiOjE3MjIwMDU0NzIsImlhdCI6MTcyMjAwNTQxMiwiYXV0aF90aW1lIjoxNzIyMDA1NDExLCJqdGkiOiJlNTZjZjU1OS03ZWEwLTQxOWE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ZpY2UiOiJETlBBRiAvIFJPSVNTWSA5NSIsIm5hbWUiOiJKYW5lIERvZSIsInBob25lX251bWJlciI6IjAxMjM0NTY3ODkiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJnZW5kYXJtZXJpZSIsImdpdmVuX25hbWUiOiJKYW5lIiwiZmFtaWx5X25hbWUiOiJEb2UiLCJlbWFpbCI6ImphbmUuZG9lQGdlbmRhcm1lcmllLmdvdXYuZnIifQ.pChWFGGPU8PKSJo0IKpExrVLUCH_zfnihDcXnTb7Vx_Tfto_JCB6JV7mSguTdz5p1ZA-wWLjbSsLBH8xZ8RnGshSuLORs3bWHFPKMSO_0xurWj8S1GwF3Lf6T4mPWpVfQahlB9HWcLvT9gJTMklTRLmoktqu5cKzuyy5PSzVZeZKTHgz3BcS6cN80_frujmZcDdB3Vjl6FeuFrvXkjQSaM3XvyfzeujAEoPg7VcGfBbm3lhpzNXBjuw86RdM5PtQLn3LS4yEbsmtCsztC5MNL70ctTK2eoq2cv7drXUVO1VfpMwKQVdKZDUvzs8ApziDtsUGJUeMb8O51u1SV6DPig"


@pytest.mark.skip(reason="Cannot currently run in CI.")
# @pytest.mark.skip(reason="Cannot currently run in CI.")
class TestAuthentication:
def test_jwks(self):
print(PUBLIC_KEY)
Expand All @@ -18,6 +18,5 @@ def test_jwks(self):
token,
PUBLIC_KEY,
algorithms=["RS256"],
audience=["master-realm", "account"],
)
)
Loading

0 comments on commit 714487f

Please sign in to comment.