Skip to content

Commit cb83c58

Browse files
committed
eslint passing
1 parent 87258fb commit cb83c58

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

examples/mongodb/model.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ module.exports.saveToken = function(token, client, user) {
9090
// Can't just chain `lean()` to `save()` as we did with `findOne()` elsewhere. Instead we use `Promise` to resolve the data.
9191
return new Promise( function(resolve,reject){
9292
accessToken.save(function(err,data){
93-
if( err ) reject( err );
94-
else resolve( data );
93+
if( err ) {reject( err );}
94+
else {resolve( data );}
9595
}) ;
9696
}).then(function(saveResult){
9797
// `saveResult` is mongoose wrapper object, not doc itself. Calling `toJSON()` returns the doc.
98-
saveResult = saveResult && typeof saveResult == 'object' ? saveResult.toJSON() : saveResult;
98+
saveResult = saveResult && typeof saveResult === 'object' ? saveResult.toJSON() : saveResult;
9999

100100
// Unsure what else points to `saveResult` in oauth2-server, making copy to be safe
101101
var data = new Object();
102-
for( var prop in saveResult ) data[prop] = saveResult[prop];
102+
for( var prop in saveResult ) {data[prop] = saveResult[prop];}
103103

104104
// /oauth-server/lib/models/token-model.js complains if missing `client` and `user`. Creating missing properties.
105105
data.client = data.clientId;

examples/postgresql/model.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports.getAccessToken = function(bearerToken) {
2727
* Get client.
2828
*/
2929

30-
module.exports.getClient = function *(clientId, clientSecret) {
30+
module.exports.getClient = function(clientId, clientSecret) {
3131
return pg.query('SELECT client_id, client_secret, redirect_uri FROM oauth_clients WHERE client_id = $1 AND client_secret = $2', [clientId, clientSecret])
3232
.then(function(result) {
3333
var oAuthClient = result.rows[0];
@@ -48,7 +48,7 @@ module.exports.getClient = function *(clientId, clientSecret) {
4848
* Get refresh token.
4949
*/
5050

51-
module.exports.getRefreshToken = function *(bearerToken) {
51+
module.exports.getRefreshToken = function(bearerToken) {
5252
return pg.query('SELECT access_token, access_token_expires_on, client_id, refresh_token, refresh_token_expires_on, user_id FROM oauth_tokens WHERE refresh_token = $1', [bearerToken])
5353
.then(function(result) {
5454
return result.rowCount ? result.rows[0] : false;
@@ -59,7 +59,7 @@ module.exports.getRefreshToken = function *(bearerToken) {
5959
* Get user.
6060
*/
6161

62-
module.exports.getUser = function *(username, password) {
62+
module.exports.getUser = function(username, password) {
6363
return pg.query('SELECT id FROM users WHERE username = $1 AND password = $2', [username, password])
6464
.then(function(result) {
6565
return result.rowCount ? result.rows[0] : false;
@@ -70,7 +70,7 @@ module.exports.getUser = function *(username, password) {
7070
* Save token.
7171
*/
7272

73-
module.exports.saveAccessToken = function *(token, client, user) {
73+
module.exports.saveAccessToken = function(token, client, user) {
7474
return pg.query('INSERT INTO oauth_tokens(access_token, access_token_expires_on, client_id, refresh_token, refresh_token_expires_on, user_id) VALUES ($1, $2, $3, $4)', [
7575
token.accessToken,
7676
token.accessTokenExpiresOn,

test/integration/index_test.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ describe('ExpressOAuthServer', function() {
108108
request(app.listen())
109109
.get('/')
110110
.set('Authorization', 'Bearer foobar')
111-
.expect(200, function(err, res){
112-
spy.called.should.be.True();
113-
done(err);
111+
.expect(200, function(err){
112+
spy.called.should.be.true();
113+
done(err);
114114
});
115115
});
116116
});
@@ -146,9 +146,9 @@ describe('ExpressOAuthServer', function() {
146146
.post('/?state=foobiz')
147147
.set('Authorization', 'Bearer foobar')
148148
.send({ client_id: 12345, response_type: 'code' })
149-
.expect(302, function(err, res){
150-
spy.called.should.be.True();
151-
done(err);
149+
.expect(302, function(err){
150+
spy.called.should.be.true();
151+
done(err);
152152
});
153153
});
154154

@@ -243,8 +243,8 @@ describe('ExpressOAuthServer', function() {
243243
.post('/')
244244
.send('client_id=foo&client_secret=bar&grant_type=password&username=qux&password=biz')
245245
.expect({ access_token: 'foobar', token_type: 'Bearer' })
246-
.expect(200, function(err, res){
247-
spy.called.should.be.True();
246+
.expect(200, function(err){
247+
spy.called.should.be.true();
248248
done(err);
249249
});
250250
});
@@ -261,7 +261,6 @@ describe('ExpressOAuthServer', function() {
261261
return { accessToken: 'foobar', client: {}, user: {} };
262262
}
263263
};
264-
var spy = sinon.spy();
265264
var oauth = new ExpressOAuthServer({ model: model, continueMiddleware: true });
266265

267266
app.use(oauth.token());

0 commit comments

Comments
 (0)