Move findUserByEmail method from accounts-password to accounts-base

#13834
This commit is contained in:
Kelly Copley
2025-07-23 13:14:55 -04:00
committed by Italo José
parent 67f3890a69
commit 6574c3fdd7
2 changed files with 24 additions and 31 deletions

View File

@@ -338,6 +338,30 @@ export class AccountsServer extends AccountsCommon {
return user;
}
/**
* @summary Find a user by one of their email addresses.
* @locus Server
* @param {String} email The email address to look for
* @param {Object} [options]
* @param {Object} options.fields Limit the fields to return from the user document
* @returns {Promise<Object>} A user if found, else null
* @importFromPackage accounts-base
*/
findUserByEmail = async (email, options) =>
await this._findUserByQuery({ email }, options);
/**
* @summary Find a user by their username.
* @locus Server
* @param {String} username The username to look for
* @param {Object} [options]
* @param {Object} options.fields Limit the fields to return from the user document
* @returns {Promise<Object>} A user if found, else null
* @importFromPackage accounts-base
*/
findUserByUsername = async (username, options) =>
await this._findUserByQuery({ username }, options);
///
/// LOGIN METHODS
///

View File

@@ -287,37 +287,6 @@ Accounts._checkPasswordAsync = checkPasswordAsync;
///
/**
* @summary Finds the user asynchronously with the specified username.
* First tries to match username case sensitively; if that fails, it
* tries case insensitively; but if more than one user matches the case
* insensitive search, it returns null.
* @locus Server
* @param {String} username The username to look for
* @param {Object} [options]
* @param {MongoFieldSpecifier} options.fields Dictionary of fields to return or exclude.
* @returns {Promise<Object>} A user if found, else null
* @importFromPackage accounts-base
*/
Accounts.findUserByUsername =
async (username, options) =>
await Accounts._findUserByQuery({ username }, options);
/**
* @summary Finds the user asynchronously with the specified email.
* First tries to match email case sensitively; if that fails, it
* tries case insensitively; but if more than one user matches the case
* insensitive search, it returns null.
* @locus Server
* @param {String} email The email address to look for
* @param {Object} [options]
* @param {MongoFieldSpecifier} options.fields Dictionary of fields to return or exclude.
* @returns {Promise<Object>} A user if found, else null
* @importFromPackage accounts-base
*/
Accounts.findUserByEmail =
async (email, options) =>
await Accounts._findUserByQuery({ email }, options);
// XXX maybe this belongs in the check package
const NonEmptyString = Match.Where(x => {