Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (`Castle::createList`, `Castle::getAllLists`)
- **privacy** – the Privacy API (`Castle::requestUserData`, `Castle::deleteUserData`)
- **webhooks** – incoming Castle webhooks are signature-verified with `Castle_Webhook::verify` (against the `X-Castle-Signature` header) and the most recent payloads are listed
Expand Down
4 changes: 2 additions & 2 deletions src/flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function demos(): array
],
'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',
Expand Down Expand Up @@ -198,7 +198,7 @@ function decide_password_reset(array $input, array $cfg): array

// A new password that differs from the current one is a successful reset.
$status = $password === $cfg['valid_password'] ? '$failed' : '$succeeded';
$type = '$password_reset';
$type = '$profile_reset';

$payload = [
'type' => $type,
Expand Down
2 changes: 1 addition & 1 deletion tests/FlowsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function testNewPasswordLogsSucceeded(): void
], $this->cfg());

$this->assertSame('log', $decision['api_endpoint']);
$this->assertSame('$password_reset', $decision['castle_type']);
$this->assertSame('$profile_reset', $decision['castle_type']);
$this->assertSame('$succeeded', $decision['castle_status']);
$this->assertSame('clark.kent@dailyplanet.com', $decision['payload']['user']['email']);
}
Expand Down
2 changes: 1 addition & 1 deletion views/demos/password_reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

$desc = <<<HTML
<p>This demo records the password-reset event with the non-blocking <code>/log</code> endpoint, which stores the event without returning a verdict.</p>
<p>Assume the user already passed your reset challenge (e.g. an emailed OTP). Enter a value <em>different from</em> the valid password to send <code>\$password_reset / \$succeeded</code>, or the valid password to send <code>\$password_reset / \$failed</code>. (The password is not actually changed.)</p>
<p>Assume the user already passed your reset challenge (e.g. an emailed OTP). Enter a value <em>different from</em> the valid password to send <code>\$profile_reset / \$succeeded</code>, or the valid password to send <code>\$profile_reset / \$failed</code>. (The password is not actually changed.)</p>
HTML;

$scripts = <<<HTML
Expand Down