Don't enforce secure cookie flag if external URL begins with http://
Closes: #3
This commit is contained in:
parent
69b7ff179b
commit
eb60b3fbde
|
@ -36,6 +36,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
@ -141,7 +142,7 @@ func completeAuth(opts *config.Options, c *gin.Context, email string, service st
|
|||
30*24*3600, // maxAge
|
||||
opts.BaseURL+"/", // path
|
||||
"", // domain
|
||||
opts.DevProxy == "", // secure
|
||||
opts.DevProxy == "" && !strings.HasPrefix(opts.ExternalURL, "http://"), // secure
|
||||
true, // httpOnly
|
||||
)
|
||||
|
||||
|
@ -149,7 +150,15 @@ func completeAuth(opts *config.Options, c *gin.Context, email string, service st
|
|||
}
|
||||
|
||||
func logout(opts *config.Options, c *gin.Context) {
|
||||
c.SetCookie(COOKIE_NAME, "", -1, opts.BaseURL+"/", "", opts.DevProxy == "", true)
|
||||
c.SetCookie(
|
||||
COOKIE_NAME,
|
||||
"",
|
||||
-1,
|
||||
opts.BaseURL+"/",
|
||||
"",
|
||||
opts.DevProxy == "" && !strings.HasPrefix(opts.ExternalURL, "http://"),
|
||||
true,
|
||||
)
|
||||
c.JSON(http.StatusOK, true)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user