Increase login for 1 year (#222)

This commit is contained in:
Thomas Miceli 2024-02-19 02:44:37 +01:00
parent 915287dc10
commit e1303c95d0

View file

@ -6,12 +6,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/thomiceli/opengist/internal/utils"
"io"
"net/http"
"net/url"
"strings"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/markbates/goth" "github.com/markbates/goth"
"github.com/markbates/goth/gothic" "github.com/markbates/goth/gothic"
@ -22,9 +16,14 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/thomiceli/opengist/internal/config" "github.com/thomiceli/opengist/internal/config"
"github.com/thomiceli/opengist/internal/db" "github.com/thomiceli/opengist/internal/db"
"github.com/thomiceli/opengist/internal/utils"
"golang.org/x/text/cases" "golang.org/x/text/cases"
"golang.org/x/text/language" "golang.org/x/text/language"
"gorm.io/gorm" "gorm.io/gorm"
"io"
"net/http"
"net/url"
"strings"
) )
const ( const (
@ -140,6 +139,7 @@ func processLogin(ctx echo.Context) error {
} }
sess.Values["user"] = user.ID sess.Values["user"] = user.ID
sess.Options.MaxAge = 60 * 60 * 24 * 365 // 1 year
saveSession(sess, ctx) saveSession(sess, ctx)
deleteCsrfCookie(ctx) deleteCsrfCookie(ctx)