@@ -25,7 +25,7 @@ function fallbackDefaultAccountSystem(bind: typeof Accounts, username: string |
2525 }
2626 }
2727
28- logger . info ( 'Fallback to default account system' , username ) ;
28+ logger . info ( { msg : 'Fallback to default account system' , username } ) ;
2929
3030 const loginRequest = {
3131 user : username ,
@@ -125,7 +125,7 @@ export class CROWD {
125125 if ( user ) {
126126 crowdUsername = user . crowd_username ;
127127 } else {
128- logger . debug ( 'Could not find a user by email' , username ) ;
128+ logger . debug ( { msg : 'Could not find a user by email' , username } ) ;
129129 }
130130 }
131131
@@ -143,7 +143,7 @@ export class CROWD {
143143 if ( user ) {
144144 crowdUsername = user . crowd_username ;
145145 } else {
146- logger . debug ( 'Could not find a user with by crowd_username' , username ) ;
146+ logger . debug ( { msg : 'Could not find a user with by crowd_username' , username } ) ;
147147 }
148148 }
149149
@@ -157,7 +157,7 @@ export class CROWD {
157157 if ( ! user && crowdUsername ) {
158158 logger . debug ( 'New user. User is not synced yet.' ) ;
159159 }
160- logger . debug ( 'Going to crowd: ' , crowdUsername ) ;
160+ logger . debug ( { msg : 'Going to crowd' , crowdUsername } ) ;
161161
162162 return new Promise ( ( resolve , reject ) =>
163163 this . crowdClient . user . authenticate ( crowdUsername , password , async ( err : any , res : Record < string , any > ) => {
@@ -241,9 +241,9 @@ export class CROWD {
241241
242242 for await ( const user of users ) {
243243 let crowdUsername = user . hasOwnProperty ( 'crowd_username' ) ? user . crowd_username : user . username ;
244- logger . info ( 'Syncing user' , crowdUsername ) ;
244+ logger . info ( { msg : 'Syncing user' , crowdUsername } ) ;
245245 if ( ! crowdUsername ) {
246- logger . warn ( 'User has no crowd_username' , user . username ) ;
246+ logger . warn ( { msg : 'User has no crowd_username' , username : user . username } ) ;
247247 continue ;
248248 }
249249
@@ -252,28 +252,28 @@ export class CROWD {
252252 try {
253253 crowdUser = await this . fetchCrowdUser ( crowdUsername ) ;
254254 } catch ( err ) {
255- logger . debug ( { err } ) ;
255+ logger . debug ( { msg : 'Error while syncing user from CROWD' , err } ) ;
256256 logger . error ( { msg : 'Could not sync user with username' , crowd_username : crowdUsername } ) ;
257257
258258 const email = user . emails ?. [ 0 ] . address ;
259- logger . info ( 'Attempting to find for user by email' , email ) ;
259+ logger . info ( { msg : 'Attempting to find user by email' , email } ) ;
260260
261261 const response = await this . searchForCrowdUserByMail ( email ) ;
262262 if ( ! response || response . users . length === 0 ) {
263- logger . warn ( 'Could not find user in CROWD with username or email: ' , crowdUsername , email ) ;
263+ logger . warn ( { msg : 'Could not find user in CROWD with username or email' , crowd_username : crowdUsername , email } ) ;
264264 if ( settings . get ( 'CROWD_Remove_Orphaned_Users' ) === true ) {
265- logger . info ( 'Removing user: ' , crowdUsername ) ;
265+ logger . info ( { msg : 'Removing user' , crowd_username : crowdUsername } ) ;
266266 setImmediate ( async ( ) => {
267267 await deleteUser ( user . _id ) ;
268- logger . info ( 'User removed: ' , crowdUsername ) ;
268+ logger . info ( { msg : 'User removed' , crowd_username : crowdUsername } ) ;
269269 } ) ;
270270 }
271271 return ;
272272 }
273273 crowdUsername = response . users [ 0 ] . name ;
274- logger . info ( 'User found by email. Syncing user' , crowdUsername ) ;
274+ logger . info ( { msg : 'User found by email. Syncing user' , crowd_username : crowdUsername } ) ;
275275 if ( ! crowdUsername ) {
276- logger . warn ( 'User has no crowd_username' , user . username ) ;
276+ logger . warn ( { msg : 'User has no crowd_username' , username : user . username } ) ;
277277 continue ;
278278 }
279279
@@ -368,7 +368,7 @@ Accounts.registerLoginHandler('crowd', async function (this: typeof Accounts, lo
368368 return undefined ;
369369 }
370370
371- logger . info ( 'Init CROWD login' , loginRequest . username ) ;
371+ logger . info ( { msg : 'Init CROWD login' , username : loginRequest . username } ) ;
372372
373373 if ( settings . get ( 'CROWD_Enable' ) !== true ) {
374374 return fallbackDefaultAccountSystem ( this , loginRequest . username , loginRequest . crowdPassword ) ;
@@ -379,12 +379,12 @@ Accounts.registerLoginHandler('crowd', async function (this: typeof Accounts, lo
379379 const user = await crowd . authenticate ( loginRequest . username , loginRequest . crowdPassword ) ;
380380
381381 if ( user && user . crowd === false ) {
382- logger . debug ( `User ${ loginRequest . username } is not a valid crowd user, falling back` ) ;
382+ logger . debug ( { msg : 'User is not a valid crowd user, falling back' , username : loginRequest . username } ) ;
383383 return fallbackDefaultAccountSystem ( this , loginRequest . username , loginRequest . crowdPassword ) ;
384384 }
385385
386386 if ( ! user ) {
387- logger . debug ( `User ${ loginRequest . username } is not allowed to access Rocket.Chat` ) ;
387+ logger . debug ( { msg : 'User is not allowed to access Rocket.Chat' , username : loginRequest . username } ) ;
388388 return new Meteor . Error ( 'not-authorized' , 'User is not authorized by crowd' ) ;
389389 }
390390
0 commit comments