aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/v1/users.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-01 16:03:53 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-01 16:03:53 +0200
commit69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd (patch)
tree8659f819818a3da6419959b6b7838a7f0557c948 /server/controllers/api/v1/users.js
parenta3ee6fa22dee4b68fcde9cd23708b471db446e11 (diff)
downloadPeerTube-69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd.tar.gz
PeerTube-69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd.tar.zst
PeerTube-69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd.zip
OAuth/User models refractoring -> use mongoose api
Diffstat (limited to 'server/controllers/api/v1/users.js')
-rw-r--r--server/controllers/api/v1/users.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js
index 7ce0b9c6a..caa979567 100644
--- a/server/controllers/api/v1/users.js
+++ b/server/controllers/api/v1/users.js
@@ -1,15 +1,16 @@
1'use strict' 1'use strict'
2 2
3const config = require('config') 3const config = require('config')
4const mongoose = require('mongoose')
4const express = require('express') 5const express = require('express')
5const oAuth2 = require('../../../middlewares').oauth2 6const oAuth = require('../../../middlewares').oauth
6 7
7const Users = require('../../../models/users') 8const Client = mongoose.model('OAuthClient')
8 9
9const router = express.Router() 10const router = express.Router()
10 11
11router.get('/client', getAngularClient) 12router.get('/client', getAngularClient)
12router.post('/token', oAuth2.token, success) 13router.post('/token', oAuth.token, success)
13 14
14// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
15 16
@@ -27,7 +28,7 @@ function getAngularClient (req, res, next) {
27 28
28 if (req.get('host') !== headerHostShouldBe) return res.type('json').status(403).end() 29 if (req.get('host') !== headerHostShouldBe) return res.type('json').status(403).end()
29 30
30 Users.getFirstClient(function (err, client) { 31 Client.loadFirstClient(function (err, client) {
31 if (err) return next(err) 32 if (err) return next(err)
32 if (!client) return next(new Error('No client available.')) 33 if (!client) return next(new Error('No client available.'))
33 34