diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-11 21:19:34 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 14:23:11 +0200 |
commit | bc503c2a62dcf9aed6b8d90b68f0f27a7755ac01 (patch) | |
tree | a1fe1ad88afd29ee4d7cb05c480649d5a9c6f9a0 /server/models/users.js | |
parent | 881a5e68b64e4acd43408852bbdc914643d8fac6 (diff) | |
download | PeerTube-bc503c2a62dcf9aed6b8d90b68f0f27a7755ac01.tar.gz PeerTube-bc503c2a62dcf9aed6b8d90b68f0f27a7755ac01.tar.zst PeerTube-bc503c2a62dcf9aed6b8d90b68f0f27a7755ac01.zip |
Update to standard 7. Goodbye snake_case, I used to love you
Diffstat (limited to 'server/models/users.js')
-rw-r--r-- | server/models/users.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server/models/users.js b/server/models/users.js index a852bf25b..a1bdece23 100644 --- a/server/models/users.js +++ b/server/models/users.js | |||
@@ -45,11 +45,11 @@ const Users = { | |||
45 | function createClient (secret, grants, callback) { | 45 | function createClient (secret, grants, callback) { |
46 | logger.debug('Creating client.') | 46 | logger.debug('Creating client.') |
47 | 47 | ||
48 | const mongo_id = new mongoose.mongo.ObjectID() | 48 | const mongoId = new mongoose.mongo.ObjectID() |
49 | return OAuthClientsDB.create({ _id: mongo_id, clientSecret: secret, grants: grants }, function (err) { | 49 | return OAuthClientsDB.create({ _id: mongoId, clientSecret: secret, grants: grants }, function (err) { |
50 | if (err) return callback(err) | 50 | if (err) return callback(err) |
51 | 51 | ||
52 | return callback(null, mongo_id) | 52 | return callback(null, mongoId) |
53 | }) | 53 | }) |
54 | } | 54 | } |
55 | 55 | ||
@@ -73,8 +73,8 @@ function getClient (clientId, clientSecret) { | |||
73 | logger.debug('Getting Client (clientId: ' + clientId + ', clientSecret: ' + clientSecret + ').') | 73 | logger.debug('Getting Client (clientId: ' + clientId + ', clientSecret: ' + clientSecret + ').') |
74 | 74 | ||
75 | // TODO req validator | 75 | // TODO req validator |
76 | const mongo_id = new mongoose.mongo.ObjectID(clientId) | 76 | const mongoId = new mongoose.mongo.ObjectID(clientId) |
77 | return OAuthClientsDB.findOne({ _id: mongo_id, clientSecret: clientSecret }) | 77 | return OAuthClientsDB.findOne({ _id: mongoId, clientSecret: clientSecret }) |
78 | } | 78 | } |
79 | 79 | ||
80 | function getClients (callback) { | 80 | function getClients (callback) { |
@@ -99,7 +99,7 @@ function getUsers (callback) { | |||
99 | function saveToken (token, client, user) { | 99 | function saveToken (token, client, user) { |
100 | logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.') | 100 | logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.') |
101 | 101 | ||
102 | const token_to_create = { | 102 | const tokenToCreate = { |
103 | accessToken: token.accessToken, | 103 | accessToken: token.accessToken, |
104 | accessTokenExpiresOn: token.accessTokenExpiresOn, | 104 | accessTokenExpiresOn: token.accessTokenExpiresOn, |
105 | client: client.id, | 105 | client: client.id, |
@@ -108,13 +108,13 @@ function saveToken (token, client, user) { | |||
108 | user: user.id | 108 | user: user.id |
109 | } | 109 | } |
110 | 110 | ||
111 | return OAuthTokensDB.create(token_to_create, function (err, token_created) { | 111 | return OAuthTokensDB.create(tokenToCreate, function (err, tokenCreated) { |
112 | if (err) throw err // node-oauth2-server library uses Promise.try | 112 | if (err) throw err // node-oauth2-server library uses Promise.try |
113 | 113 | ||
114 | token_created.client = client | 114 | tokenCreated.client = client |
115 | token_created.user = user | 115 | tokenCreated.user = user |
116 | 116 | ||
117 | return token_created | 117 | return tokenCreated |
118 | }) | 118 | }) |
119 | } | 119 | } |
120 | 120 | ||