# account-base package ## Files documented * package.js * url_client.js * url_server.js ## Classes ### `AccountsClient` * `url_client.js` additions: * `_attemptToMatchHash()` : Try to match the saved value of window.location.hash to one of the reserved hashes, to trigger an Accounts operation. On success, invokes passed handler which, when called from `_initUrlMatching()`, will always be `defaultSuccessHandler()`. * `_initUrlMatching()`: called by constructor. Inits extra data on instance and invokes `_attemptToMatchHash()` * `onResetPasswordLink()` Register a function to call when a reset password link is clicked in an email sent by on of the hash handlers. See [Accounts-onResetPasswordLink](http://localhost:3333/#Accounts-onResetPasswordLink) * `onEmailVerificationLink()` Register a function to call when an email verification link is clicked in an email sent by a hash handler. See [Accounts-onEmailVerificationLink](http://localhost:3333/#Accounts-onEmailVerificationLink) * `onEnrollmentLink()` Register a function to call when an account enrollment link is clicked in an email sent by a hash handler. See [Accounts-onEnrollmentLink](http://localhost:3333/#Accounts-onEnrollmentLink) * Globals read * `window.location.hash`. Reserved hashes: * `reset-password` * `verify-email` * `enroll-account` * `defaultSuccessHandler()` * `attemptToMatchHash()` ### `AccountsServer` * methods. These 3 methods are public but marked (in 1.2.1) as likely not to remain so * `resetPassword()` : generates a password reset link (from token) * `verifyEmail()`: generates an email verification link (from token) * `enrollAccount()`: generates an account enrollment link (from token) ### `AccountsTest` * methods * `attemptToMatchHash()` facade for `attemptToMatchHash()` function * Globals read * `Accounts` (see `globals_server.js`) ## Functions ### `url_client.js` * `defaultSuccessHandler()` : suspends autologin, invokes other handles for the same hash, passing them a closure capable of enabling autologin. ## Dependencies / Exports (`package.js` _et al._) ### Exports | Symbol | Client | Server | Test | |------------------|:------:|:------:|:----:| | Accounts | O | O | O | | AccountsClient | O | | | | AccountsServer | | O | | | AccountsTest | | | O | ### Dependencies | Package | Client | Server | Specifics | |-----------------------|:------:|:-------:|------------| | underscore | O | O | | ecmascript | O | O | | ddp-rate-limiter | O | O | | localstorage | O | | | tracker | O | | | check | | O | | random | O | O | | ejson | | O | | callback-hook | O | O | | service-configuration | O | O | unordered (needs Accounts.connection) | ddp | O | O | | mongo | O | O | expected abstraction in the future | blaze | O | | weak: define {{currentUser}} | autopublish | | O | weak: publish extra users fields | oauth-encryption | | O | weak | NPM crypto | | O | in accounts_server.js | ## Objects (`globals_(client|server).js`) * `Accounts` * on client: `new AccountsClient()` (extends `AccountsCommon`) * on server: `new AccountsServer(Meteor.server)` (extends `AccountsCommon`) * `Meteor` * new field `users` for the `users` collection. Name is expected to become configurable in future versions.