Skip to content
Snippets Groups Projects
Commit 771c5e85 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

update main.go - review split of page state

parent 7f36dfd0
Branches
No related tags found
No related merge requests found
Pipeline #5393 passed
......@@ -101,10 +101,14 @@ func main() {
fmt.Printf("Page state: %s\n", pageState)
fmt.Printf("Page usage: %s\n", pageUsage)
state := strings.Split(pageState, "-")[0]
host := strings.Split(pageState, "-")[1]
splitIndex := strings.Index(pageUsage, "-")
if splitIndex == -1 {
fmt.Println("No host found")
}
state := string([]byte(pageUsage[0:splitIndex]))
host := string([]byte(pageUsage[splitIndex+1:len(pageUsage)]))
redir := "https://" + host + "/accounts/enedis-konnector/redirect?code=" + pageCode + "&state="+ state +"&usage_point_id=" + pageUsage
redir := host + "?code=" + pageCode + "&state="+ state +"&usage_point_id=" + pageUsage
fmt.Println(time.Now().Format("2006-01-02 15:04:05"), "- Redirect to -", redir)
http.Redirect(w, r, redir, 302)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment