Module: accounts/methods

Methods

(static) deleteAccount() → {boolean}

Deletes the current user. Works only for the user who invoked this method!

Source:
Returns:

true if removed else false

Type
boolean
Example
deleteAccount()

(static) registerNewUser(options) → {Object.<{id: string, token: string=, tokenExpires: Date=}>}

Registers a new user by email+password and minimal profile fields.

Parameters:
Name Type Description
options object
Properties
Name Type Description
email string
password string
firstName string
lastName string
loginImmediately boolean

if true performs a login after account creation

Source:
Returns:

object with at least the _id of the created user and optionally the token and tokenExpires values when user is logged in immediately

Type
Object.<{id: string, token: string=, tokenExpires: Date=}>
Example
registerNewUser({
  email: janedow@example.com,
  password: 'mysupersecretpw',
  firstName: 'Jane',
  lastName: 'Doe',
  loginImmediately: true
})

(static) updateUserProfile(firstNameopt, lastNameopt) → {boolean}

Updates the user profile fields

Parameters:
Name Type Attributes Description
firstName string <optional>
lastName string <optional>
Source:
Returns:

true if updated, otherwise false

Type
boolean
Example
updateUserProfile({ firstName: 'Jane', lastName: 'Doe' })