Commit Graph

16 Commits

Author SHA1 Message Date
matheusccastro
1ce67f6e7b Create Meteor.wrapFn to wrap hooks and functions that can/should accept a promise and apply that to accounts, startup and cursor actions code. 2023-04-19 11:48:53 -03:00
Gabriel Grubba
4582675078 docs: added docs to forEachAsync in hook.js 2023-01-05 10:06:48 -03:00
Gabriel Grubba
f3950ff881 cherry picked from e6efc44c2e 2023-01-05 09:58:50 -03:00
Jan Dvorak
8632883424 Improve comment for forEach iterator in callback-hook 2021-08-23 10:26:59 +02:00
Jan Dvorak
7e625f6f1b Deprecation jsdoc for each in callback-hook 2021-08-13 16:50:14 +02:00
Jan Dvorak
b6271d08ef callback-hook add forEach iterator to follow the JS standard 2021-08-13 10:26:31 +02:00
Jan Dvorak
f25c29a1e9 Modernize & fix bad var assignment 2021-07-21 17:15:29 +02:00
Ben Newman
ec0ed4dec9 Simplify _startupCallback by passing callback rather than ID. 2019-11-06 10:23:16 -05:00
Pravdomil
ecf726ebf3 Make _debug reporting more consistent (#9678) 2018-03-21 11:43:48 -04:00
Ben Newman
babe85f268 Remove underscore from callback-hook package. 2017-11-14 09:31:34 -05:00
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