Don't defer redirects

pull/47/merge
Pancakes 4 months ago
parent 611a0e3dec
commit ed8122cd3b
No known key found for this signature in database
GPG Key ID: 5792877BFA27DC8F

@ -33,13 +33,13 @@ var (
func HandleDiscordCallback(w http.ResponseWriter, r *http.Request) (string, error) { func HandleDiscordCallback(w http.ResponseWriter, r *http.Request) (string, error) {
code := r.URL.Query().Get("code") code := r.URL.Query().Get("code")
if code == "" { if code == "" {
defer http.Redirect(w, r, GameURL, http.StatusSeeOther) http.Redirect(w, r, GameURL, http.StatusSeeOther)
return "", errors.New("code is empty") return "", errors.New("code is empty")
} }
discordId, err := RetrieveDiscordId(code) discordId, err := RetrieveDiscordId(code)
if err != nil { if err != nil {
defer http.Redirect(w, r, GameURL, http.StatusSeeOther) http.Redirect(w, r, GameURL, http.StatusSeeOther)
return "", err return "", err
} }

@ -35,13 +35,13 @@ var (
func HandleGoogleCallback(w http.ResponseWriter, r *http.Request) (string, error) { func HandleGoogleCallback(w http.ResponseWriter, r *http.Request) (string, error) {
code := r.URL.Query().Get("code") code := r.URL.Query().Get("code")
if code == "" { if code == "" {
defer http.Redirect(w, r, GameURL, http.StatusSeeOther) http.Redirect(w, r, GameURL, http.StatusSeeOther)
return "", errors.New("code is empty") return "", errors.New("code is empty")
} }
googleId, err := RetrieveGoogleId(code) googleId, err := RetrieveGoogleId(code)
if err != nil { if err != nil {
defer http.Redirect(w, r, GameURL, http.StatusSeeOther) http.Redirect(w, r, GameURL, http.StatusSeeOther)
return "", err return "", err
} }

@ -635,7 +635,7 @@ func handleProviderCallback(w http.ResponseWriter, r *http.Request) {
}) })
} }
defer http.Redirect(w, r, account.GameURL, http.StatusSeeOther) http.Redirect(w, r, account.GameURL, http.StatusSeeOther)
} }
func handleProviderLogout(w http.ResponseWriter, r *http.Request) { func handleProviderLogout(w http.ResponseWriter, r *http.Request) {

Loading…
Cancel
Save