Accounts/Methods

Accounts/Methods

Source:

Extends Meteor's Accounts-Base with methods for Reaction-specific behavior and user interaction. Run these methods using: Meteor.call()

Example

Meteor.call("accounts/verifyAccount", email, token)

Methods

(static) accounts/addressBookRemove(addressId, accountUserIdopt) → {Object}

Remove existing address in user's profile

Source:
Parameters:
Name Type Attributes Description
addressId String

address _id

accountUserId String <optional>

account.userId used by admin to edit users

Returns:

Removed address object

Type
Object

(static) accounts/addressBookUpdate(address, accountUserIdopt, typeopt) → {Object}

Update existing address in user's profile

Source:
Parameters:
Name Type Attributes Description
address Object

address

accountUserId String | null <optional>

account.userId used by admin to edit users

type shipping | billing <optional>

name of selected address type

Returns:

The updated address

Type
Object

(static) accounts/addUserPermissions(userId, permissions, groupopt) → {Boolean}

Source:
Parameters:
Name Type Attributes Description
userId String

userId

permissions Array | String

Name of role/permission. If array, users returned will have at least one of the roles specified but need not have all roles.

group String <optional>

Optional name of group to restrict roles to. User's Roles.GLOBAL_GROUP will also be checked.

Returns:

success/failure

Type
Boolean

(static) accounts/createFallbackLoginToken() → {String|null}

Returns a new loginToken for current user, that can be used for special login scenarios e.g. store the newly created token as cookie on the browser, if the client does not offer local storage.

Source:
Returns:

loginToken for current user

Type
String | null

(static) accounts/inviteShopMember(options) → {Boolean}

Invite new admin users (not consumers) to secure access in the dashboard to permissions as specified in packages/roles

Source:
Parameters:
Name Type Description
options Object

-

Properties
Name Type Description
shopId String

shop to invite user

groupId String

groupId to invite user

email String

email of invitee

name String

name of invitee

Returns:

returns true

Type
Boolean

(static) accounts/inviteShopOwner(options, shopData) → {Boolean}

Invite a new user as owner of a new shop

Source:
Parameters:
Name Type Description
options Object

-

Properties
Name Type Description
email String

email of invitee

name String

name of invitee

shopData Object

(optional) data used to create the new shop

Returns:

returns true

Type
Boolean

(static) accounts/markAddressValidationBypassed(valueopt) → {Number}

Write that the customer has bypassed address validation

Source:
Parameters:
Name Type Attributes Description
value Boolean <optional>

Default true

Returns:

updateResult - Result of the update

Type
Number

(static) accounts/markTaxCalculationFailed(valueopt) → {Number}

Write tax calculation has failed for this customer

Source:
Parameters:
Name Type Attributes Description
value Boolean <optional>

Default true

Returns:

updateResult - Result of the update

Type
Number

(static) accounts/removeEmailAddress(email) → {Boolean}

Remove a user's email address.

Source:
Parameters:
Name Type Description
email String

user email.

Returns:
  • returns boolean.
Type
Boolean

(static) accounts/removeUserPermissions(userId, permissions, groupopt) → {Boolean}

Source:
Parameters:
Name Type Attributes Description
userId String

userId

permissions Array | String

Name of role/permission. If array, users returned will have at least one of the roles specified but need not have all roles.

group String <optional>

Optional name of group to restrict roles to.

Returns:

success/failure

Type
Boolean

(static) accounts/sendResetPasswordEmail(options) → {undefined}

Send reset password email

Source:
Example
Meteor.call("accounts/sendResetPasswordEmail", options)
Parameters:
Name Type Description
options Object

Options object

Properties
Name Type Description
email String

email of user

Returns:
Type
undefined

(static) accounts/sendWelcomeEmail(shopId, userId, token) → {Boolean}

Send an email to consumers on sign up

Source:
Parameters:
Name Type Description
shopId String

shopId of new User

userId String

new userId to welcome

token String

the token for the verification URL

Returns:

returns true on success

Type
Boolean

(static) accounts/setProfileCurrency(currencyName, accountIdopt) → {Object}

Sets users profile currency

Source:
Parameters:
Name Type Attributes Description
currencyName String

currency symbol to add to user profile

accountId String <optional>

accountId of user to set currency of. Defaults to current user ID

Returns:

Account document

Type
Object

(static) accounts/setUserPermissions(userId, permissions, group) → {Boolean}

Source:
Parameters:
Name Type Description
userId String

userId

permissions String | Array

string/array of permissions

group String

group

Returns:

returns Roles.setUserRoles result

Type
Boolean

(static) accounts/syncUsersAndAccounts() → {Boolean}

Syncs emails associated with a user profile between the Users and Accounts collections.

Source:
Returns:
  • returns boolean.
Type
Boolean

(static) accounts/updateEmailAddress(email) → {Boolean}

Update a user's email address

Source:
Parameters:
Name Type Description
email String

user email

Returns:
  • return True on success
Type
Boolean

(static) accounts/updateServiceConfiguration(service, fields) → {Boolean}

Update service configuration

Source:
Example
Meteor.call("accounts/updateServiceConfiguration", service, fields, (callBackFunction))
Parameters:
Name Type Description
service String

Service name

fields Array

Fields array

Returns:

Upsert result or false

Type
Boolean

(static) accounts/validateAddress(address) → {Object}

Validates an address, and if fails returns details of issues

Source:
Parameters:
Name Type Description
address Object

The address object to validate

Returns:
  • The results of the validation
Type
Object

(static) accounts/verifyAccount() → {Boolean}

Verifies the email address in account document (if user verification in users collection was successful already)

Source:
Example
Meteor.call("accounts/verifyAccount")
Returns:
  • returns true on success
Type
Boolean