Password reset does not need an email
This commit is contained in:
@@ -92,12 +92,14 @@ function getOwner(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function getByResetToken(email, resetToken, callback) {
|
||||
assert.strictEqual(typeof email, 'string');
|
||||
function getByResetToken(resetToken, callback) {
|
||||
assert.strictEqual(typeof resetToken, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
database.query('SELECT ' + USERS_FIELDS + ' FROM users WHERE email=? AND resetToken=?', [ email, resetToken ], function (error, result) {
|
||||
// empty reset tokens means it does not exist
|
||||
if (!resetToken) return callback(new BoxError(BoxError.NOT_FOUND, 'User not found'));
|
||||
|
||||
database.query('SELECT ' + USERS_FIELDS + ' FROM users WHERE resetToken=?', [ resetToken ], function (error, result) {
|
||||
if (error) return callback(new BoxError(BoxError.DATABASE_ERROR, error));
|
||||
if (result.length === 0) return callback(new BoxError(BoxError.NOT_FOUND, 'User not found'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user