aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/v1/users.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js
index fdbcc3ff5..d831a0de6 100644
--- a/server/controllers/api/v1/users.js
+++ b/server/controllers/api/v1/users.js
@@ -19,6 +19,7 @@ const Video = mongoose.model('Video')
19const router = express.Router() 19const router = express.Router()
20 20
21router.get('/', listUsers) 21router.get('/', listUsers)
22router.get('/me', oAuth.authenticate, getUserInformation)
22 23
23router.post('/', 24router.post('/',
24 oAuth.authenticate, 25 oAuth.authenticate,
@@ -63,6 +64,14 @@ function createUser (req, res, next) {
63 }) 64 })
64} 65}
65 66
67function getUserInformation (req, res, next) {
68 User.loadByUsername(res.locals.oauth.token.user.username, function (err, user) {
69 if (err) return next(err)
70
71 return res.json(user.toFormatedJSON())
72 })
73}
74
66function listUsers (req, res, next) { 75function listUsers (req, res, next) {
67 User.list(function (err, usersList) { 76 User.list(function (err, usersList) {
68 if (err) return next(err) 77 if (err) return next(err)