Commit Graph

6 Commits

Author SHA1 Message Date
Dean Brettle
587e02a692 Fix issue #4862. Don't wrap login callbacks with bindEnvironment.
Changes to packages/callback-hook:
- Add bindEnvironment option to Hook constructor (defaults to true).
- Add internal helper function dontBindEnvironment() which does all the
  error handling stuff like Meteor.bindEnvironment() but doesn't change
  the environment.
- Use dontBindEnvironment() instead of Meteor.bindEnvironment() when
  bindEnvironment option is false.
- Add tests.

Changes to packages/accounts-base:
- Create hooks with { bindEnvironment: false }
- Add test for whether Meteor.userId() is available in login callbacks.
2015-08-03 10:52:11 -07:00
David Glasser
8a16f50138 Ensure that hook.each is called from a Fiber
That gives us enough guarantees that we can simplify the error-handling
code.

We also ensure that the "new connection" handler in livedata_server runs
in a Fiber, which fixes a bug introduced in d049bf7506 where connections
from pre-pre1 clients would crash (due to Meteor.setTimeout which only
works in a Fiber).
2014-03-17 15:49:27 -07:00
Nick Martin
af4bf909fd Add comment linking to hackpad. 2014-03-11 01:37:58 -07:00
Andrew Wilcox
2a5425fcb6 Misc login hooks code review items 2014-02-16 19:57:04 -05:00
Andrew Wilcox
f5ed36293b Clone the attempt object passed to login hooks, so the original can't
be modified by hook callbacks.

Give the Hook constructor a named option to debug print and ignore
exceptions, as just passing in a string argument to do that wasn't
very clear.
2014-02-16 19:24:15 -05:00
Andrew Wilcox
df3230c1b3 Login hooks.
Adds `Accounts.validateLoginAttempt`, `Accounts.onLogin`, and
`Accounts.onLoginFailure`.

The process for logging in a user is consolidated in accounts-base,
which is now the only package which directly accesses login tokens in
the database.

All login methods now go through `Accounts._loginMethod`, which
ensures that exceptions are captured and login hooks are called in all
cases.

The callback hook implementation code from livedata is extracted into
an internal `callback-hook` package, where it can be used by accounts.
2014-02-05 17:40:20 -05:00