-
-
Notifications
You must be signed in to change notification settings - Fork 949
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: include flow id in use recovery token query (#2679)
This PR adds the `selfservice_recovery_flow_id` to the query used when "using" a token in the recovery flow. This PR also adds a new enum field for `identity_recovery_tokens` to distinguish the two flows: admin versus self-service recovery. BREAKING CHANGES: This patch invalidates recovery flows initiated using the Admin API. Please re-generate any admin-generated recovery flows and tokens.
- Loading branch information
1 parent
1cd2672
commit d56586b
Showing
15 changed files
with
143 additions
and
50 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...ql/migrations/sql/20220824165300000000_add_flow_type_to_identity_recovery_tokens.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE identity_recovery_tokens | ||
DROP token_type; |
2 changes: 2 additions & 0 deletions
2
.../sql/migrations/sql/20220824165300000000_add_flow_type_to_identity_recovery_tokens.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE identity_recovery_tokens | ||
ADD token_type int NOT NULL DEFAULT 0; |
Empty file.
7 changes: 7 additions & 0 deletions
7
...ence/sql/migrations/sql/20220824165300000001_populate_flow_type_in_recovery_tokens.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE identity_recovery_tokens | ||
SET token_type = 1 | ||
WHERE selfservice_recovery_flow_id IS NULL; | ||
|
||
UPDATE identity_recovery_tokens | ||
SET token_type = 2 | ||
WHERE selfservice_recovery_flow_id IS NOT NULL; |
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
...nce/sql/migrations/sql/20220824165300000002_add_flow_type_check_constraint.sqlite3.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- SQLITE does not support Check constraints in all cases |
2 changes: 2 additions & 0 deletions
2
persistence/sql/migrations/sql/20220824165300000002_add_flow_type_check_constraint.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE identity_recovery_tokens | ||
ADD CONSTRAINT identity_recovery_tokens_token_type_ck CHECK (token_type = 1 OR token_type = 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.