Use temporary redirects

This commit is contained in:
2019-06-03 15:06:57 +09:00
parent e11295019b
commit cf258573a8
12 changed files with 28 additions and 23 deletions

View File

@ -32,6 +32,6 @@ func Install(app *aero.Application) {
ctx.Session().Delete("userId")
}
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
})
}

View File

@ -48,7 +48,7 @@ func InstallFacebookAuth(app *aero.Application) {
app.Get("/auth/facebook", func(ctx aero.Context) error {
state := ctx.Session().ID()
url := config.AuthCodeURL(state)
return ctx.Redirect(http.StatusFound, url)
return ctx.Redirect(http.StatusTemporaryRedirect, url)
})
// This is the redirect URL that we specified in the OAuth2 config.
@ -111,7 +111,7 @@ func InstallFacebookAuth(app *aero.Application) {
// Log
authLog.Info("Added Facebook ID to existing account | %s | %s | %s | %s | %s", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
var getErr error
@ -129,7 +129,7 @@ func InstallFacebookAuth(app *aero.Application) {
user.Save()
session.Set("userId", user.ID)
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
// Try to find an existing user via the associated e-mail address
@ -142,7 +142,7 @@ func InstallFacebookAuth(app *aero.Application) {
user.Save()
session.Set("userId", user.ID)
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
// Register new user
@ -173,6 +173,6 @@ func InstallFacebookAuth(app *aero.Application) {
authLog.Info("Registered new user via Facebook | %s | %s | %s | %s | %s", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())
// Redirect to starting page for new users
return ctx.Redirect(http.StatusFound, newUserStartRoute)
return ctx.Redirect(http.StatusTemporaryRedirect, newUserStartRoute)
})
}

View File

@ -55,7 +55,7 @@ func InstallGoogleAuth(app *aero.Application) {
app.Get("/auth/google", func(ctx aero.Context) error {
state := ctx.Session().ID()
url := config.AuthCodeURL(state)
return ctx.Redirect(http.StatusFound, url)
return ctx.Redirect(http.StatusTemporaryRedirect, url)
})
// This is the redirect URL that we specified in the OAuth2 config.
@ -122,7 +122,7 @@ func InstallGoogleAuth(app *aero.Application) {
// Log
authLog.Info("Added Google ID to existing account | %s | %s | %s | %s | %s", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
var getErr error
@ -137,7 +137,7 @@ func InstallGoogleAuth(app *aero.Application) {
user.Save()
session.Set("userId", user.ID)
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
// Try to find an existing user via the associated e-mail address
@ -153,7 +153,7 @@ func InstallGoogleAuth(app *aero.Application) {
user.Save()
session.Set("userId", user.ID)
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
// Register new user
@ -184,6 +184,6 @@ func InstallGoogleAuth(app *aero.Application) {
authLog.Info("Registered new user via Google | %s | %s | %s | %s | %s", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())
// Redirect to starting page for new users
return ctx.Redirect(http.StatusFound, newUserStartRoute)
return ctx.Redirect(http.StatusTemporaryRedirect, newUserStartRoute)
})
}

View File

@ -53,7 +53,7 @@ func InstallTwitterAuth(app *aero.Application) {
ctx.Session().Set("tempCred", tempCred)
url := config.AuthorizationURL(tempCred, nil)
return ctx.Redirect(http.StatusFound, url)
return ctx.Redirect(http.StatusTemporaryRedirect, url)
})
// This is the redirect URL that we specified in /auth/twitter.
@ -124,7 +124,7 @@ func InstallTwitterAuth(app *aero.Application) {
// Log
authLog.Info("Added Twitter ID to existing account | %s | %s | %s | %s | %s", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
var getErr error
@ -139,7 +139,7 @@ func InstallTwitterAuth(app *aero.Application) {
user.Save()
session.Set("userId", user.ID)
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
// Try to find an existing user via the associated e-mail address
@ -156,7 +156,7 @@ func InstallTwitterAuth(app *aero.Application) {
user.Save()
session.Set("userId", user.ID)
return ctx.Redirect(http.StatusFound, "/")
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
// Register new user
@ -191,6 +191,6 @@ func InstallTwitterAuth(app *aero.Application) {
authLog.Info("Registered new user via Twitter | %s | %s | %s | %s | %s", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())
// Redirect to starting page for new users
return ctx.Redirect(http.StatusFound, newUserStartRoute)
return ctx.Redirect(http.StatusTemporaryRedirect, newUserStartRoute)
})
}