https://github.com/gwendall/meteor-accounts-helpers
Hooks and helpers for user accounts
https://github.com/gwendall/meteor-accounts-helpers
Last synced: about 1 month ago
JSON representation
Hooks and helpers for user accounts
- Host: GitHub
- URL: https://github.com/gwendall/meteor-accounts-helpers
- Owner: gwendall
- Created: 2015-02-26T15:23:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-10T20:21:25.000Z (almost 7 years ago)
- Last Synced: 2025-04-23T01:44:37.445Z (about 1 month ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```diff
- NOTE: This package is not maintained anymore.
- If you want to help, please reach out to [email protected]
```This package provides helpful helpers to deal with users.
Installation
------------``` sh
meteor add gwendall:accounts-helpers
```## Client methods
***Accounts.onLogin(cb)***
Hook for user log in.
```javascript
Accounts.onLogin(function() {
console.log('You are logged in.');
});
```***Accounts.onLogout(cb)***
Hook for user log out.
```javascript
Accounts.onLogout(function() {
console.log('You are logged out.');
});
```***Accounts.onConnect(cb(provider))***
Hook for user connection to a social account when already logged in.
Requires [splendido:accounts-meld](https://github.com/splendido/meteor-accounts-meld/).
```javascript
Accounts.onConnect(function(provider) {
console.log('You have connected your ' + provider + ' account.');
});
```***Accounts.onDisconnect(cb(provider))***
Hook for user disconnection from a social account when already logged in.
Requires [splendido:accounts-meld](https://github.com/splendido/meteor-accounts-meld/).
```javascript
Accounts.onDisconnect(function(provider) {
console.log('You have disconnected your ' + provider + ' account.');
});
```***Accounts.disconnect(provider, cb)***
Disconnect a social account.
Requires [splendido:accounts-meld](https://github.com/splendido/meteor-accounts-meld/).
```javascript
Accounts.disconnect('facebook', function() {
console.log('You have disconnected your Facebook account.');
});
```## Client template helpers
```html
Login with {{provider}}
```
Logs in the user with a given provider.```html
Disconnect {{provider}}
```
Removes the given provider's credentials from the user.
Requires [splendido:accounts-meld](https://github.com/splendido/meteor-accounts-meld/).```html
Log out
```
Logs the user out.## Server methods
***Accounts.onJoin(cb(data))***
On user joins for the first time. The hook does not get triggered when Accounts.createUser is called with no client / user intent.
```javascript
Accounts.onJoin(function(data) {
console.log('A user has joined from ' + data.type);
});
```***Accounts.disconnect(userId, provider)***
Disconnect an account provider.
Requires [splendido:accounts-meld](https://github.com/splendido/meteor-accounts-meld/).
```javascript
USER_ID = '...';
Accounts.disconnect(USER_ID, 'facebook');
```