fix: SetAuthCookie needs the jwt

This commit is contained in:
Derrick Hammer 2024-03-17 09:18:01 -04:00
parent 675a583422
commit d893216831
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 3 additions and 3 deletions

View File

@ -99,7 +99,7 @@ func JWTVerifyToken(token string, domain string, privateKey ed25519.PrivateKey,
return claim, err return claim, err
} }
func SetAuthCookie(jc jape.Context, apiName string) { func SetAuthCookie(jc jape.Context, jwt string, apiName string) {
for name, api := range apiRegistry.GetAllAPIs() { for name, api := range apiRegistry.GetAllAPIs() {
routeableApi, ok := api.(router.RoutableAPI) routeableApi, ok := api.(router.RoutableAPI)
if !ok { if !ok {

View File

@ -118,7 +118,7 @@ func (a AccountAPI) login(jc jape.Context) {
return return
} }
account.SetAuthCookie(jc, "") account.SetAuthCookie(jc, jwt, "")
account.SendJWT(jc, jwt) account.SendJWT(jc, jwt)
jc.Encode(&LoginResponse{ jc.Encode(&LoginResponse{
@ -213,7 +213,7 @@ func (a AccountAPI) otpValidate(jc jape.Context) {
return return
} }
account.SetAuthCookie(jc, "") account.SetAuthCookie(jc, jwt, "")
account.SendJWT(jc, jwt) account.SendJWT(jc, jwt)
jc.Encode(&LoginResponse{ jc.Encode(&LoginResponse{