1
1
var plugin = { } ,
2
2
fs = require ( 'fs' ) ,
3
3
path = require ( 'path' ) ,
4
- common = require ( '../../../api/utils/common.js' ) ,
5
- async = require ( 'async' ) ,
4
+ common = require ( '../../../api/utils/common.js' ) ,
6
5
parser = require ( 'properties-parser' ) ,
7
6
plugins = require ( '../../pluginManager.js' ) ;
8
7
9
- ( function ( plugin ) {
8
+ ( function ( ) {
10
9
plugins . register ( '/i/plugins' , function ( ob ) {
11
10
var params = ob . params ;
12
11
var validateUserForWriteAPI = ob . validateUserForWriteAPI ;
@@ -76,8 +75,10 @@ var plugin = {},
76
75
try {
77
76
data = require ( fullpath + '/package.json' ) ;
78
77
}
79
- catch ( ex ) { }
80
- var ob = { } ;
78
+ catch ( ex ) {
79
+ // Error
80
+ }
81
+ ob = { } ;
81
82
if ( pluginList . indexOf ( file ) > - 1 ) {
82
83
ob . enabled = true ;
83
84
}
@@ -96,7 +97,7 @@ var plugin = {},
96
97
//we need to get localization only if plugin is disabled
97
98
if ( ! ob . enabled ) {
98
99
var local_path = fullpath + "/frontend/public/localization/" + ob . code + ".properties" ;
99
- if ( params . member . lang && params . member . lang != "en" ) {
100
+ if ( params . member . lang && params . member . lang !== "en" ) {
100
101
local_path = fullpath + "/frontend/public/localization/" + ob . code + "_" + params . member . lang + ".properties" ;
101
102
}
102
103
if ( fs . existsSync ( local_path ) ) {
@@ -174,9 +175,11 @@ var plugin = {},
174
175
updateArr . ends = data . frontend . session_timeout * 60 + Math . round ( Date . now ( ) / 1000 ) ;
175
176
updateArr . ttl = data . frontend . session_timeout * 60 ;
176
177
}
177
- if ( params . member . settings && params . member . settings . frontend && typeof data . frontend . session_timeout !== "undefined" ) { }
178
+ if ( params . member . settings && params . member . settings . frontend && typeof data . frontend . session_timeout !== "undefined" ) {
179
+ // Empty block
180
+ }
178
181
else { //if not set member value
179
- common . db . collection ( "auth_tokens" ) . update ( { "owner" : ob . params . member . _id + "" , "purpose" : "LoggedInAuth" } , { $set : updateArr } , function ( err , res1 ) {
182
+ common . db . collection ( "auth_tokens" ) . update ( { "owner" : ob . params . member . _id + "" , "purpose" : "LoggedInAuth" } , { $set : updateArr } , function ( err ) {
180
183
if ( err ) {
181
184
console . log ( err ) ;
182
185
}
@@ -233,7 +236,7 @@ var plugin = {},
233
236
updateArr . ttl = data . frontend . session_timeout * 60 ;
234
237
}
235
238
236
- common . db . collection ( "auth_tokens" ) . update ( { "owner" : ob . params . member . _id + "" , "purpose" : "LoggedInAuth" } , { $set : updateArr } , function ( err , res1 ) {
239
+ common . db . collection ( "auth_tokens" ) . update ( { "owner" : ob . params . member . _id + "" , "purpose" : "LoggedInAuth" } , { $set : updateArr } , function ( err ) {
237
240
if ( err ) {
238
241
console . log ( err ) ;
239
242
}
0 commit comments