Reformat the code using 2 space identation

This commit is contained in:
Raymond Feng 2013-12-18 11:49:09 -08:00
parent 95ad3e8c04
commit 598b1e6b61
2 changed files with 251 additions and 253 deletions

View File

@ -80,7 +80,6 @@ var ApplicationSchema = {
modified: {type: Date, default: Date}
};
/**
* Application management functions
*/
@ -126,13 +125,13 @@ Application.register = function (owner, name, options, cb) {
assert(owner, 'owner is required');
assert(name, 'name is required');
if(typeof options === 'function' && !cb) {
if (typeof options === 'function' && !cb) {
cb = options;
options = {};
}
var props = {owner: owner, name: name};
for(var p in options) {
if(!(p in props)) {
for (var p in options) {
if (!(p in props)) {
props[p] = options[p];
}
}
@ -143,7 +142,7 @@ Application.register = function (owner, name, options, cb) {
* Reset keys for the application instance
* @param cb
*/
Application.prototype.resetKeys = function(cb) {
Application.prototype.resetKeys = function (cb) {
this.clientKey = generateKey('client');
this.javaScriptKey = generateKey('javaScript');
this.restApiKey = generateKey('restApi');
@ -158,9 +157,9 @@ Application.prototype.resetKeys = function(cb) {
* @param appId
* @param cb
*/
Application.resetKeys = function(appId, cb) {
Application.findById(appId, function(err, app) {
if(err) {
Application.resetKeys = function (appId, cb) {
Application.findById(appId, function (err, app) {
if (err) {
cb && cb(err, app);
return;
}
@ -174,15 +173,15 @@ Application.resetKeys = function(appId, cb) {
* @param key
* @param cb
*/
Application.authenticate = function(appId, key, cb) {
Application.findById(appId, function(err, app) {
if(err || !app) {
Application.authenticate = function (appId, key, cb) {
Application.findById(appId, function (err, app) {
if (err || !app) {
cb && cb(err, null);
return;
}
var matched = null;
['clientKey', 'javaScriptKey', 'restApiKey', 'windowsKey', 'masterKey'].forEach(function(k) {
if(app[k] === key) {
['clientKey', 'javaScriptKey', 'restApiKey', 'windowsKey', 'masterKey'].forEach(function (k) {
if (app[k] === key) {
matched = k;
}
});

View File

@ -147,7 +147,6 @@ describe('Application', function () {
});
});
it('Authenticate with application id & windowsKey', function (done) {
Application.authenticate(registeredApp.id, registeredApp.windowsKey,
function (err, result) {