From 5ec811b5d1899cfe538ed6d19c8a5ee01a553f03 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 15 Mar 2017 13:28:53 -0700 Subject: using api.ErrNoAuth return from auth check in examples --- examples/deleteable/content/song.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/deleteable/content/song.go') diff --git a/examples/deleteable/content/song.go b/examples/deleteable/content/song.go index 2198e33..b33bad0 100644 --- a/examples/deleteable/content/song.go +++ b/examples/deleteable/content/song.go @@ -8,6 +8,7 @@ import ( "github.com/ponzu-cms/ponzu/management/editor" "github.com/ponzu-cms/ponzu/system/admin/user" + "github.com/ponzu-cms/ponzu/system/api" "github.com/ponzu-cms/ponzu/system/item" ) @@ -87,9 +88,7 @@ func (s *Song) BeforeAPIDelete(res http.ResponseWriter, req *http.Request) error // for example, this will check if the request was made by a CMS admin user: if !user.IsValid(req) { - addr := req.RemoteAddr - err := fmt.Errorf("request rejected, invalid user. IP: %s", addr) - return err + return api.ErrNoAuth } // you could then to data validation on the request post form, or do it in -- cgit v1.2.3