mirror of
https://github.com/meteor/meteor.git
synced 2026-01-11 00:28:02 -05:00
Move findUserByEmail method from accounts-password to accounts-base
#13834
This commit is contained in:
@@ -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
|
||||
///
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user