Coder Social home page Coder Social logo

meteor-accounts-entry's Introduction

Build Status

accounts-entry

NOTE: This is forked from [https://github.com/Differential/accounts-entry] (https://github.com/Differential/accounts-entry) eliminated coffeescript, simpleForm and t9n (replaced by [anti:i18n] (https://github.com/anticoders/meteor-i18n))

accounts-entry is a meteorite package that relies on Iron Router and provides an alternative interface to accounts-ui, with whole pages for sign up and sign in.

Compatibility

accounts-entry is presently compatible with Iron Router 1.0.0 and above. Since meteorite doesn't support semantic version locking.

Getting started

Run:

For Meteor 1.2.0.1 version

meteor add selaias:accounts-entry

For 1.1.0.3 and below

meteor add selaias:accounts-entry@=0.5.0

You can install the accounts-ui package, as it is still used for OAuth setup.

Provided routes

You will get routes and the necessary templates for:

/sign-in
/sign-out
/sign-up
/forgot-password
/verification-pending

You can then either add links to those directly, or use the {{>accountButtons }} helper to give you the apppropriate links for signed-in/signed-out users. The {{>accountButtons }} helper will display a sign-out link and the user's email address when they are signed-in.

Ensuring signed in users for routes

Simply add the following line of code: AccountsEntry.signInRequired(this); to require users be signed in for a route and to redirect the user to the included sign-in page and stop any rendering. Accounts-entry also tracks where the user was trying to go and will route them back after sign in.

Here is an Iron-Router route example:

  Router.route('userProfile', {
    path: '/profile',
    template: 'profile',
    onBeforeAction: function () {
      AccountsEntry.signInRequired(this);
      this.next();
    }
  });

Setting up password login

Use meteor add accounts-password if you want to have email/username login authentication options. This is now optional and will only display if installed. You need to configure an OAuth option if you choose not to have password logins.

Setting up OAuth/social integrations

Use accounts-ui to configure your social/OAuth integrations (or manually create records in your database, if you have those skills). We don't have the nice instructions on how to configure the services built into this package, but if you choose to use {{>loginButtons }} elsewhere in your application (even temporarily), you can configure OAuth logins there.

Configuration

Signup codes

We have added support for a signupCode in case you want to have a special code to handout to keep signups at a pace you want. This code is checked if you turn on the client and server side options listed below.

The signup code is only checked for accounts-password logins, so know that OAuth logins will still allow people in.

In CLIENT code only

Since this is a young package, we are maintaining compatibility with accounts-ui (so if in a pinch accounts-entry is broken for you, you could easily switch to accounts-ui). We also use the UI for oauth configs from accounts-ui.

  Meteor.startup(function () {
    AccountsEntry.config({
      logo: 'logo.png',                          // if set displays logo above sign-in options
      privacyUrl: '/privacy-policy',             // if set adds link to privacy policy and 'you agree to ...' on sign-up page
      termsUrl: '/terms-of-use',                 // if set adds link to terms  'you agree to ...' on sign-up page
      homeRoute: '/',                            // mandatory - path to redirect to after sign-out
      dashboardRoute: '/dashboard',              // mandatory - path to redirect to after successful sign-in
      profileRoute: 'profile',                   // if set adds link to User Profile
      passwordSignupFields: 'EMAIL_ONLY',        // One of 'USERNAME_AND_EMAIL', 'USERNAME_AND_OPTIONAL_EMAIL', 'USERNAME_ONLY', or 'EMAIL_ONLY' (default).
      showSignupCode: true,                      // when true you need to set the 'signupCode' setting in the server (see below)
      showOtherLoginServices: true,              // Set to false to hide oauth login buttons on the signin/signup pages. Useful if you are using something like accounts-meld or want to oauth for api access
      passwordminLength: 7,                      // Password minimun lenght
      requireOneAlpha: true,                     // enforce the use of at least 1 char [a-z] while building the password
      requireOneDigit: true,                     // enforce the use of at least 1 digit while building the password
      requirePasswordConfirmation: true,         // enforce user to confirm password on signUp and resetPassword templates
      waitEmailVerification: true                // Set to true to wait until newly created user's email has been verified. 
      extraSignUpFields: [{                      // Add extra signup fields on the signup page
        field: "name",                           // The database property you want to store the data in
        name: "This Will Be The Initial Value",  // An initial value for the field, if you want one
        label: "Full Name",                      // The html lable for the field
        placeholder: "John Doe",                 // A placeholder for the field
        type: "text",                            // The type of field you want
        required: true                           // Adds html 5 required property if true
       }]
    });
  });

In SERVER code only

Call AccountsEntry.config with a hash of optional configuration:

  Meteor.startup(function () {
    AccountsEntry.config({
      signupCode: 's3cr3t',         // only restricts username+password users, not OAuth
      showSignupCode: true,         // place it also on server for extra security
      waitEmailVerification: true   // will not allow users to login until their email is verified.
      defaultProfile:{
          someDefault: 'default'
          }
    });
  });

Note: only set a signupCode if you want to use that feature.

The default configuration includes:

  wrapLinks: true                   // wraps accounts-entry links in <li> for bootstrap compatability purposes
  homeRoute: '/'                    // MUST BE SET - redirect to this path after sign-out
  dashboardRoute: '/dashboard'      // MUST BE SET - redirect to this path after sign-in

Remember, you must provide a route for home (used when signing out) and dashboard (used after signing in).

meteor-accounts-entry's People

Contributors

benmgreene avatar chris-jamieson avatar selaias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

meteor-accounts-entry's Issues

Registration code is incorrect

When I try to Create an Account I get an error alert every time saying Registration Code is Incorrect. Terminal error says - Exception while invoking method 'entryValidateSignupCode' ReferenceError: Match is not defined at [object Object].Meteor.methods.entryValidateSignupCode (packages/selaias_accounts-entry/server/entry.js:48:1)

[email protected]
iron:[email protected]

Any help would be much appreciated.

Translations integration

First of all - Great work,

Second how can I make it work with translations.
Int the 1.1 I've manged to translate using softwarerero:accounts-t9n

This time it doesn't work

Tal

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.