fix: logout should set address to / and open /

This commit is contained in:
efim 2023-10-09 05:42:50 +00:00
parent a367ed9a34
commit ec47c9d610
3 changed files with 10 additions and 3 deletions

View File

@ -242,7 +242,11 @@ https://stackoverflow.com/questions/62307431/firefox-sends-secure-cookies-to-loc
see: except on localhost : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
** TODO maybe add middleware so that 401 would be a page, and not json
** TODO prettying up server responses for "we show html" land
let's do this also, yes
*** DONE logout should push root url in htmx
*** TODO lets make 404 page and return it
*** TODO lets make 401 page and return it
** TODO get icons for the auth providers. surely they are accessible from the pocketbase itself?
http://localhost:8090/_/images/oauth2/apple.svg
yes.
@ -253,3 +257,6 @@ https://pocketbase.io/docs/go-migrations/#enable-go-migrations
if i understood correctly, when i enable migration generation
i would be able to modify locally run instance via admin interface,
go files with migration would be generated, i'll have to import them somewhere in my main module, and then after building/packaging when i run `serve` on production the migrations would run on the production data
** adding google oauth
support article : https://developers.google.com/identity/sign-in/web/sign-in
settings are in : https://console.cloud.google.com/apis/credentials

View File

@ -101,7 +101,7 @@ func getLogoutRoute(app *pocketbase.PocketBase) func(*core.ServeEvent) error {
HttpOnly: true,
})
c.Response().Header().Add("HX-Trigger", "auth-change-event")
return c.JSON(http.StatusOK, map[string]string{"message": "session cookie removed"})
return c.NoContent(http.StatusOK)
})
return nil
}

View File

@ -16,7 +16,7 @@
></script>
<script defer src="/static/static/public/htmx.min.js"></script>
</head>
<body hx-get="/" hx-trigger="auth-change-event">
<body hx-get="/" hx-trigger="auth-change-event" hx-push-url="true">
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please