docs: readme and comments
This commit is contained in:
@@ -14,6 +14,8 @@ import (
|
||||
|
||||
const AuthCookieName = "Auth"
|
||||
|
||||
// registeres on pocketbase middleware that
|
||||
// Sets and Reads session data into a secure cookie
|
||||
func AddCookieSessionMiddleware(app *pocketbase.PocketBase) {
|
||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
e.Router.Use(loadAuthContextFromCookie(app))
|
||||
@@ -35,6 +37,7 @@ func AddCookieSessionMiddleware(app *pocketbase.PocketBase) {
|
||||
})
|
||||
return nil
|
||||
})
|
||||
// fires for admin authentication
|
||||
app.OnAdminAuthRequest().Add(func(e *core.AdminAuthEvent) error {
|
||||
e.HttpContext.SetCookie(&http.Cookie{
|
||||
Name: AuthCookieName,
|
||||
|
||||
Reference in New Issue
Block a user