diff options
Diffstat (limited to 'server/controllers/api/v1')
-rw-r--r-- | server/controllers/api/v1/users.js | 9 |
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') | |||
19 | const router = express.Router() | 19 | const router = express.Router() |
20 | 20 | ||
21 | router.get('/', listUsers) | 21 | router.get('/', listUsers) |
22 | router.get('/me', oAuth.authenticate, getUserInformation) | ||
22 | 23 | ||
23 | router.post('/', | 24 | router.post('/', |
24 | oAuth.authenticate, | 25 | oAuth.authenticate, |
@@ -63,6 +64,14 @@ function createUser (req, res, next) { | |||
63 | }) | 64 | }) |
64 | } | 65 | } |
65 | 66 | ||
67 | function 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 | |||
66 | function listUsers (req, res, next) { | 75 | function 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) |