aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/api/user.go b/api/user.go
index 3cddb46..a231e8c 100644
--- a/api/user.go
+++ b/api/user.go
@@ -13,6 +13,18 @@ import (
"github.com/miniflux/miniflux/http/response/json"
)
+// CurrentUser is the API handler to retrieve the authenticated user.
+func (c *Controller) CurrentUser(w http.ResponseWriter, r *http.Request) {
+ ctx := context.New(r)
+ user, err := c.store.UserByID(ctx.UserID())
+ if err != nil {
+ json.ServerError(w, err)
+ return
+ }
+
+ json.OK(w, user)
+}
+
// CreateUser is the API handler to create a new user.
func (c *Controller) CreateUser(w http.ResponseWriter, r *http.Request) {
ctx := context.New(r)