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
Hooks Accounts.onLogin/onLoginFailure should be available on client #3572
Comments
Thanks for the feature request! You might be interested in reading our feature request guidelines. |
FWIW I've also have a need for this in the past and |
Thanks @stubailo so much for the reply! My previous attempts:
IMHO, this is common pattern in many apps and can be as simple as:
Hope to submit some code shortly. |
Yeah I would look at a PR for this. |
Reference |
Thanks for pointing @AnthonyAstige that out. Unfortunately the You get callback on each page reload, not only when you login. It is approach #2 I described few comments above. |
Merged the PR! Right now there is no way of knowing how the login is triggered because we decided not to pass through the arguments, but you can reliably get a callback on login. |
I'm not sure I buy the reasoning about not including the method name and arguments, but we can always add it later. But removing the error from the failure hook seems pretty extreme to me. Overall though this is a great addition to Meteor! |
I think a point could be made that it is good to not have the arguments, because any random client-side library could then add a callback and get the new user's password. |
meteor/meteor#3572 [stubailo] Improve docs
meteor/meteor#3572 [stubailo] Improve docs
meteor/meteor#3572 [stubailo] Improve docs
meteor/meteor#3572 [stubailo] Improve docs
meteor/meteor#3572 [stubailo] Improve docs
meteor/meteor#3572 [stubailo] Improve docs
meteor/meteor#3572 [stubailo] Improve docs
Maybe not returning the whole arguments but at least the type, so on the client we can run code onLogin and code onResume. |
Currently
Accounts
hooksonLogin
andonLoginFailure
are available only on server.I am trying to add logic that would move user to certain page on login and it is hard to implement without the hook.
However, it looks logically that this methods should be isomorphic on client. This is one of the core Meteor design philosophy.
Happy to try to implement myself, but would like to get blessing from MDG. Do I sound reasonable?😄
The only tricky part is that the attempt object would be a bit different on server vs. client (user and connection object). Though I would note it in documentation, I wouldn't worry about it.
The text was updated successfully, but these errors were encountered: