From 1284c2df918f24162da1fd70fc28cf064a83aeb1 Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sat, 27 Jan 2024 16:24:59 +0530 Subject: [PATCH] Fixes error handling in recovery flow --- api/settings.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api/settings.go b/api/settings.go index 93565d4..34dcd0d 100644 --- a/api/settings.go +++ b/api/settings.go @@ -36,15 +36,6 @@ func HandleGetSettingsFlow(c *gin.Context) { flow, flow_cookie, err := settings.InitializeSettingsFlowWrapper(session_cookie, recovery_cookie) - c.SetCookie("settings_flow", flow_cookie, 3600, "/", config.NymeriaConfig.URL.Domain, true, true) - - if recovery_cookie != "" { - recovery_cookie = "ory_kratos_session=" + recovery_cookie - c.SetCookie("sdslabs_session", recovery_cookie, 900, "/", config.NymeriaConfig.URL.Domain, true, true) - } - - flowID := flow.GetId() - if err != nil { log.ErrorLogger("Initialize Settings flow Failed", err) c.JSON(http.StatusInternalServerError, gin.H{ @@ -53,6 +44,15 @@ func HandleGetSettingsFlow(c *gin.Context) { return } + c.SetCookie("settings_flow", flow_cookie, 3600, "/", config.NymeriaConfig.URL.Domain, true, true) + + if recovery_cookie != "" { + recovery_cookie = "ory_kratos_session=" + recovery_cookie + c.SetCookie("sdslabs_session", recovery_cookie, 900, "/", config.NymeriaConfig.URL.Domain, false, true) + } + + flowID := flow.GetId() + var csrf_token string for _, node := range flow.Ui.Nodes {