Grouping route
This commit is contained in:
@ -48,21 +48,22 @@ func GET(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := app.Server.Cache.GetCache(r.Context(), "CsrfTokens:"+r.URL.Query().Get("state"))
|
||||
if err != nil {
|
||||
if errors.Is(err, redis.Nil) {
|
||||
http.Redirect(w, r, fmt.Sprintf("/signin?error=%s", "csrf_token_error"), http.StatusFound)
|
||||
http.Redirect(w, r, fmt.Sprintf("/auth/signin?error=%s", "csrf_token_error"), http.StatusFound)
|
||||
return
|
||||
}
|
||||
app.Server.Logger.Error(err.Error())
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
err = app.Server.Cache.DeleteCache(r.Context(), "CsrfTokens:"+r.URL.Query().Get("state"))
|
||||
if err != nil {
|
||||
http.Redirect(w, r, fmt.Sprintf("/signin?error=%s", "csrf_token_error"), http.StatusFound)
|
||||
http.Redirect(w, r, fmt.Sprintf("/auth/signin?error=%s", "csrf_token_error"), http.StatusFound)
|
||||
return
|
||||
}
|
||||
|
||||
if err := r.URL.Query().Get("error"); err != "" {
|
||||
http.Redirect(w, r, fmt.Sprintf("/signin?error=%s", err), http.StatusFound)
|
||||
http.Redirect(w, r, fmt.Sprintf("/auth/signin?error=%s", err), http.StatusFound)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/fossyy/filekeeper/types/models"
|
||||
"github.com/fossyy/filekeeper/utils"
|
||||
"github.com/fossyy/filekeeper/view/client/auth"
|
||||
signupView "github.com/fossyy/filekeeper/view/client/signup"
|
||||
signupView "github.com/fossyy/filekeeper/view/client/auth/signup"
|
||||
"github.com/google/uuid"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"net/http"
|
||||
@ -27,7 +27,7 @@ func GET(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := app.Server.Cache.GetCache(r.Context(), "GoogleSetup:"+code)
|
||||
if err != nil {
|
||||
if errors.Is(err, redis.Nil) {
|
||||
http.Redirect(w, r, "/signup", http.StatusSeeOther)
|
||||
http.Redirect(w, r, "/auth/signup", http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user