File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -69,20 +69,19 @@ export class UserController extends AdaptableController {
69
69
}
70
70
71
71
checkResetTokenValidity ( username , token ) {
72
- return new Promise ( ( resolve , reject ) => {
73
- return this . config . database . collection ( '_User' ) . then ( coll => {
74
- return coll . findOne ( {
75
- username : username ,
76
- _perishable_token : token ,
77
- } , ( err , doc ) => {
78
- if ( err || ! doc ) {
79
- reject ( err ) ;
80
- } else {
81
- resolve ( doc ) ;
82
- }
83
- } ) ;
72
+ return this . config . database . adaptiveCollection ( '_User' )
73
+ . then ( collection => {
74
+ return collection . find ( {
75
+ username : username ,
76
+ _perishable_token : token
77
+ } , { limit : 1 } ) ;
78
+ } )
79
+ . then ( results => {
80
+ if ( results . length != 1 ) {
81
+ return Promise . reject ( ) ;
82
+ }
83
+ return results [ 0 ] ;
84
84
} ) ;
85
- } ) ;
86
85
}
87
86
88
87
getUserIfNeeded ( user ) {
You can’t perform that action at this time.
0 commit comments