Skip to content

Commit

Permalink
changes recovery from link to code
Browse files Browse the repository at this point in the history
  • Loading branch information
pratham1729 committed Sep 3, 2023
1 parent 573878a commit fb79eb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func HandlePostRecoveryFlow(c *gin.Context) {
return
}

session, err := recovery.SubmitRecoveryFlowWrapper(cookie, t.FlowID, t.CsrfToken, t.Email, t.Method)
session, err := recovery.SubmitRecoveryFlowWrapper(cookie, t.FlowID, t.CsrfToken, t.Code, t.Method)

if err != nil {
log.ErrorLogger("POST Recovery flow failed", err)
Expand Down
8 changes: 4 additions & 4 deletions pkg/wrapper/kratos/recovery/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func InitializeRecoveryFlowWrapper() (string, string, string, error) {
return setCookie, resp.Id, csrf_token, nil
}

func SubmitRecoveryFlowWrapper(cookie string, flowID string, csrfToken string, email string, method string) (string, error) {
func SubmitRecoveryFlowWrapper(cookie string, flowID string, csrfToken string, code string, method string) (string, error) {

submitFlowBody := client.SubmitSelfServiceRecoveryFlowBody{
SubmitSelfServiceRecoveryFlowWithLinkMethodBody: client.NewSubmitSelfServiceRecoveryFlowWithLinkMethodBody(email, method),
SubmitSelfServiceRecoveryFlowWithCodeMethodBody: client.NewSubmitSelfServiceRecoveryFlowWithCodeMethodBody(method),
}

submitFlowBody.SubmitSelfServiceRecoveryFlowWithLinkMethodBody.SetCsrfToken(csrfToken)
submitFlowBody.SubmitSelfServiceRecoveryFlowWithCodeMethodBody.SetCode(code)
submitFlowBody.SubmitSelfServiceRecoveryFlowWithCodeMethodBody.SetCsrfToken(csrfToken)

apiClient := client.NewAPIClient(config.KratosClientConfig)
_, r, err := apiClient.V0alpha2Api.SubmitSelfServiceRecoveryFlow(context.Background()).Flow(flowID).SubmitSelfServiceRecoveryFlowBody(submitFlowBody).Cookie(cookie).Execute()
Expand Down
2 changes: 1 addition & 1 deletion pkg/wrapper/kratos/recovery/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package recovery
type SubmitRecoveryAPIBody struct {
CsrfToken string `json:"csrf_token"`
FlowID string `json:"flowID"`
Email string `json:"email"`
Code string `json:"code"`
Method string `json:"method"`
}

0 comments on commit fb79eb7

Please sign in to comment.