Giter Club home page Giter Club logo

meteor-accounts-guest's Introduction

accounts-guest

============

Automatically add visitor as anonymous guest with userId

Features

  • each non-logged in visitor gets a userId, accessible via Accounts and Meteor:userId()
  • includes configurable cleanup function
  • supports truly anonymous guests which do not require accounts-password

Installation

meteor add artwells:accounts-guest

Followed by

meteor add accounts-ui

or

meteor add ian:accounts-ui-bootstrap-3

or any other accounts-ui derivative.

optionally (to clean out old guest accounts) in server-only code

Accounts.removeOldGuests([time before]);

Now Meteor.userId() will be populated for each new visitor, including across reloads

Examples

/* clean out all guest accounts more than 24 hours old (default behavior) */
Accounts.removeOldGuests();

or

/* clean out all guest accounts more than 2 hours old */
var before = new Date();
before.setHours(before.getHours() - 2);
Accounts.removeOldGuests(before);

Options (Set in server code at start up)

  • AccountsGuest.enabled, default true. Automatically logs in all visitors.
  • AccountsGuest.forced, default true. Will force recently logged out accounts into guest mode.
  • AccountsGuest.name, default false. If true, assign the guest a friendly nickname.
  • AccountsGuest.anonymous, default false. If true, do not require acccounts-password and make guests anonymous (i.e. no auto-generated username and email).

##Option Examples

In code available to server, to temporarily or conditionally disable guest login

AccountsGuest.enabled = false

In code available to client, to temporarily or conditionally disable guest login after user logout

AccountsGuest.enabled = true

In code available to server, to assign the guest a friendly nickname

AccountsGuest.name = true

In code available to server, to not require acccounts-password and make guests anonymous (i.e. no auto-generated username and email).:

AccountsGuest.anonymous = true

TODO

  • tests for forced, and enabled options
  • Allow guest session merged into new session if a visitor logs in
  • Allow merged session/other variables to be specified in config

meteor-accounts-guest's People

Contributors

artwells avatar brettle avatar dcsan avatar leoc avatar nanderson94 avatar prinzdezibel avatar srtucker22 avatar versoul avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.