Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Accounts.config.defaultFieldsSelector. #11158

Open
santiagopuentep opened this issue Sep 2, 2020 · 1 comment
Open

Problems with Accounts.config.defaultFieldsSelector. #11158

santiagopuentep opened this issue Sep 2, 2020 · 1 comment

Comments

@santiagopuentep
Copy link

@santiagopuentep santiagopuentep commented Sep 2, 2020

On Meteor 1.11, adding the defaultFieldsSelector config of Accounts.config has two problems:

  1. BUG: it makes the Accounts.forgotPassword always return an error of "No such email" if the defaultFieldsSelector doesn't have email as a default field. It seems to be missing an internal fields selector on the internal query to the users collection.
  2. LIMITATION: the Accounts.onLogin callback has no way of configuring the fields returned in the user that's given in the callback parameter.

Expected behavior:

forgotPassword should work without errors when the Accounts.config.defaultFieldsSelector doesn't have the email as a default field. It seems to be missing a selector in it's internal query to the users collection.
Accounts.onLogin should allow to configure a selector for the user object that's given inside the callback parameter.

To reproduce the problem:

  1. add Accounts.config({defaultFieldsSelector: {_id: 1}}); somewhere on the project (both client and server).
  2. to see the forgot password error call:
Accounts.forgotPassword({ email: value }, (error) => {
	if (error) {
		console.log(error);
	} else {
		console.log("success");
	}
});
  1. Call Accounts.onLogin((loginData) => {console.log(loginData.user)}); to see that the user always return only the _id, but there's no way to make it return the username or email for only that callback unless adding those values to the defaultFieldsSelector.
@anatdagan
Copy link

@anatdagan anatdagan commented Oct 8, 2020

Hi, please assign this issue to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.