2018-03-14 19:13:20 +00:00
|
|
|
package animelist
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/notify.moe/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Redirect to the full URL including the user nick.
|
|
|
|
func Redirect(ctx *aero.Context) string {
|
|
|
|
user := utils.GetUser(ctx)
|
|
|
|
|
|
|
|
if user == nil {
|
2018-07-07 03:42:00 +00:00
|
|
|
return ctx.Error(http.StatusUnauthorized, "Not logged in")
|
2018-03-14 19:13:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.Redirect("/+" + user.Nick + ctx.URI())
|
|
|
|
}
|