Initial commit, pt. 12

This commit is contained in:
Dmitrii Okunev
2024-06-09 00:29:23 +01:00
parent f942ba3aeb
commit a5ee9dfe10
8 changed files with 423 additions and 52 deletions

View File

@@ -82,7 +82,11 @@ func NewCodeReceiver(redirectURL string) (codeCh chan string, err error) {
codeCh <- code
listener.Close()
w.Header().Set("Content-Type", "text/plain")
fmt.Fprintf(w, "Received code: %v\r\nYou can now safely close this browser window.", code)
if code == "" {
fmt.Fprintf(w, "No code received :(\r\n\r\nYou can close this browser window.")
return
}
fmt.Fprintf(w, "Received code: %v\r\n\r\nYou can now safely close this browser window.", code)
}))
return codeCh, nil