User edit -> Alpine Ajax

This commit is contained in:
Simon Martens
2025-05-29 16:21:59 +02:00
parent cbbfa77865
commit 3b9ec7d493
7 changed files with 39 additions and 34 deletions

View File

@@ -1,6 +1,8 @@
package templating
import (
"fmt"
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
"github.com/pocketbase/pocketbase/core"
)
@@ -83,3 +85,10 @@ func (r *Request) IsEditor() bool {
}
return false
}
func (r *Request) CheckCSRF(target string) error {
if r.Session() == nil || target == "" || r.Session().Token != target {
return fmt.Errorf("CSRF-Token nicht vorhanden oder ungültig")
}
return nil
}