Skip to content

Commit

Permalink
fix: add return_to parameter to API spec of createRecoveryLinkForIden…
Browse files Browse the repository at this point in the history
…tity
  • Loading branch information
zepatrik committed Jan 24, 2024
1 parent ce6b11a commit 6bab5d5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
8 changes: 8 additions & 0 deletions internal/client-go/api_identity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions internal/httpclient/api_identity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion selfservice/strategy/link/strategy_recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func (s *Strategy) PopulateRecoveryMethod(r *http.Request, f *recovery.Flow) err
type createRecoveryLinkForIdentity struct {
// in: body
Body createRecoveryLinkForIdentityBody
// in: query
ReturnTo string `json:"return_to"`
}

// Create Recovery Link for Identity Request Body
Expand Down Expand Up @@ -156,7 +158,7 @@ func (s *Strategy) createRecoveryLinkForIdentity(w http.ResponseWriter, r *http.
}
}

if time.Now().Add(expiresIn).Before(time.Now()) {
if expiresIn <= 0 {
s.d.Writer().WriteError(w, r, errors.WithStack(herodot.ErrBadRequest.WithReasonf(`Value from "expires_in" must be result to a future time: %s`, p.ExpiresIn)))
return
}
Expand Down
9 changes: 9 additions & 0 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -4379,6 +4379,15 @@
"post": {
"description": "This endpoint creates a recovery link which should be given to the user in order for them to recover\n(or activate) their account.",
"operationId": "createRecoveryLinkForIdentity",
"parameters": [
{
"in": "query",
"name": "return_to",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
Expand Down
5 changes: 5 additions & 0 deletions spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,11 @@
"schema": {
"$ref": "#/definitions/createRecoveryLinkForIdentityBody"
}
},
{
"type": "string",
"name": "return_to",
"in": "query"
}
],
"responses": {
Expand Down

0 comments on commit 6bab5d5

Please sign in to comment.