diff --git a/app.py b/app.py index 85488f6..c2bb829 100644 --- a/app.py +++ b/app.py @@ -286,7 +286,7 @@ def evaluate_new_password(): else: castle_status = "$succeeded" - castle_type = "$password_reset" + castle_type = "$profile_reset" payload_to_castle = { 'type': castle_type, @@ -299,7 +299,7 @@ def evaluate_new_password(): 'request_token': request_token } - # $password_reset is a good fit for the non-blocking log endpoint: we want + # $profile_reset is a good fit for the non-blocking log endpoint: we want # to record the event without waiting on a verdict. castle = Client.from_request(request) castle.log(payload_to_castle) diff --git a/demo_config.py b/demo_config.py index 99fd920..3c0598e 100644 --- a/demo_config.py +++ b/demo_config.py @@ -19,7 +19,7 @@ }, "password_reset": { "friendly_name": "password reset", - "blurb": "Record a password-reset event with the non-blocking log endpoint." + "blurb": "Record a password-reset event ($profile_reset) with the non-blocking log endpoint." }, "lists": { "friendly_name": "lists", diff --git a/readme.md b/readme.md index 89607a4..58e4606 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@ the backend, which calls Castle and acts on the verdict. - **sign up** – `$registration` to `filter` (anonymous, so the email goes in `params`): `$attempted` for a new email, `$failed` (resolved via `matching_user_id`) for an email that already exists - **login** – `$login` reusing one request token across two calls: `filter` `$attempted` first, then `risk` `$succeeded` on success or `filter` `$failed` (wrong password / unknown user) - **account** – post-login actions: profile update (`$profile_update` to `risk`), a custom event (`Castle.custom()`), and logout (`$logout` via the non-blocking `log` endpoint) -- **password reset** – `$password_reset` via the non-blocking `log` endpoint +- **password reset** – `$profile_reset` via the non-blocking `log` endpoint - **lists** – the Lists API (`create_list`, `get_all_lists`) - **privacy** – the Privacy API (`request_user_data`, `delete_user_data`) - **webhooks** – incoming Castle webhooks are signature-verified with `WebhooksVerify` (against the `X-Castle-Signature` header) and the most recent payloads are listed diff --git a/templates/password_reset.html b/templates/password_reset.html index e9132d8..e78311c 100644 --- a/templates/password_reset.html +++ b/templates/password_reset.html @@ -19,7 +19,7 @@ {% block desc %}

This demo records the password-reset event with the non-blocking /log endpoint, which stores the event without returning a verdict.

-

Assume the user already passed your reset challenge (e.g. an emailed OTP). Enter a value different from the valid password to send $password_reset / $succeeded, or the valid password to send $password_reset / $failed. (The password is not actually changed.)

+

Assume the user already passed your reset challenge (e.g. an emailed OTP). Enter a value different from the valid password to send $profile_reset / $succeeded, or the valid password to send $profile_reset / $failed. (The password is not actually changed.)

{% endblock %} diff --git a/tests/test_sdk_integration.py b/tests/test_sdk_integration.py index 158718a..ba47317 100644 --- a/tests/test_sdk_integration.py +++ b/tests/test_sdk_integration.py @@ -203,7 +203,7 @@ def test_new_password_logs_succeeded(self, client, fake_sdk): fake_sdk.log.assert_called_once() sent = fake_sdk.log.call_args.args[0] - assert sent["type"] == "$password_reset" + assert sent["type"] == "$profile_reset" assert sent["status"] == "$succeeded" assert sent["user"]["email"] == "clark.kent@dailyplanet.com" @@ -216,6 +216,7 @@ def test_reusing_current_password_logs_failed(self, client, fake_sdk): body = resp.get_json() assert body["status"] == "$failed" fake_sdk.log.assert_called_once() + assert fake_sdk.log.call_args.args[0]["type"] == "$profile_reset" assert fake_sdk.log.call_args.args[0]["status"] == "$failed"