Remove direct mongo collection access from UserController.checkResetTokenValidity.
This commit is contained in:
@@ -69,20 +69,19 @@ export class UserController extends AdaptableController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkResetTokenValidity(username, token) {
|
checkResetTokenValidity(username, token) {
|
||||||
return new Promise((resolve, reject) => {
|
return this.config.database.adaptiveCollection('_User')
|
||||||
return this.config.database.collection('_User').then(coll => {
|
.then(collection => {
|
||||||
return coll.findOne({
|
return collection.find({
|
||||||
username: username,
|
username: username,
|
||||||
_perishable_token: token,
|
_perishable_token: token
|
||||||
}, (err, doc) => {
|
}, { limit: 1 });
|
||||||
if (err || !doc) {
|
})
|
||||||
reject(err);
|
.then(results => {
|
||||||
} else {
|
if (results.length != 1) {
|
||||||
resolve(doc);
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
});
|
return results[0];
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserIfNeeded(user) {
|
getUserIfNeeded(user) {
|
||||||
|
|||||||
Reference in New Issue
Block a user