File tree 1 file changed +5
-12
lines changed
bin/scripts/member-managament
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,11 @@ pluginManager.dbConnection().then(async(countlyDb) => {
24
24
console . log ( `The following ${ users . length } user(s) 2FA will be disabled: ` ) ;
25
25
console . log ( JSON . stringify ( users ) ) ;
26
26
if ( ! dry_run ) {
27
- await Promise . all ( users . map ( async ( user ) => {
28
- let userId = user . _id ;
29
- await countlyDb . collection ( "members" ) . findAndModify (
30
- { _id : userId } ,
31
- { } ,
32
- {
33
- $set : { "two_factor_auth.enabled" : false } ,
34
- $unset : { "two_factor_auth.secret_token" : "" }
35
- }
36
- ) ;
37
- console . log ( "2FA removed: " , JSON . stringify ( user ) ) ;
38
- } ) ) ;
27
+ await countlyDb . collection ( 'members' ) . updateMany ( { _id : { $in : users . map ( user => user . _id ) } } ,
28
+ {
29
+ $set : { "two_factor_auth.enabled" : false } ,
30
+ $unset : { "two_factor_auth.secret_token" : "" }
31
+ } ) ;
39
32
console . log ( "All done" ) ;
40
33
}
41
34
}
You can’t perform that action at this time.
0 commit comments