refactor: use SetAuthCookie and set both DEFAULT_AUTH_COOKIE_NAME and s5 authCookieName
This commit is contained in:
parent
51c7211c39
commit
6c58f6bd6c
|
@ -8,7 +8,6 @@ import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.lumeweb.com/LumeWeb/portal/api/swagger"
|
"git.lumeweb.com/LumeWeb/portal/api/swagger"
|
||||||
|
|
||||||
|
@ -119,13 +118,8 @@ func (a AccountAPI) login(jc jape.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
http.SetCookie(jc.ResponseWriter, &http.Cookie{
|
account.SetAuthCookie(jc.ResponseWriter, middleware.DEFAULT_AUTH_COOKIE_NAME, jwt)
|
||||||
Name: "jwt",
|
account.SetAuthCookie(jc.ResponseWriter, authCookieName, jwt)
|
||||||
Value: jwt,
|
|
||||||
Expires: time.Now().Add(24 * time.Hour),
|
|
||||||
HttpOnly: true,
|
|
||||||
Path: "/",
|
|
||||||
})
|
|
||||||
account.SendJWT(jc, jwt)
|
account.SendJWT(jc, jwt)
|
||||||
|
|
||||||
jc.Encode(&LoginResponse{
|
jc.Encode(&LoginResponse{
|
||||||
|
@ -220,13 +214,8 @@ func (a AccountAPI) otpValidate(jc jape.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
http.SetCookie(jc.ResponseWriter, &http.Cookie{
|
account.SetAuthCookie(jc.ResponseWriter, middleware.DEFAULT_AUTH_COOKIE_NAME, jwt)
|
||||||
Name: "jwt",
|
account.SetAuthCookie(jc.ResponseWriter, authCookieName, jwt)
|
||||||
Value: jwt,
|
|
||||||
Expires: time.Now().Add(24 * time.Hour),
|
|
||||||
HttpOnly: true,
|
|
||||||
Path: "/",
|
|
||||||
})
|
|
||||||
account.SendJWT(jc, jwt)
|
account.SendJWT(jc, jwt)
|
||||||
|
|
||||||
jc.Encode(&LoginResponse{
|
jc.Encode(&LoginResponse{
|
||||||
|
|
Loading…
Reference in New Issue