GithubHelp home page GithubHelp logo

differential / accounts-entry Goto Github PK

View Code? Open in Web Editor NEW
305.0 27.0 189.0 1 MB

Meteor sign up and sign in pages

Home Page: http://github.differential.com/accounts-entry/

License: MIT License

CoffeeScript 72.65% CSS 4.05% HTML 18.21% JavaScript 5.10%

accounts-entry's Introduction

#UNMAINTAINED Due to the adoption of React by the Meteor community and the continual updating of Meteor's own Account UI this project is no longer maintained.

The last version of Meteor this package supports is 1.1.0.3

If you are looking for similar packages, take a look at useraccounts:iron-routing


Stories in Ready

Meteor accounts-entry Build Status

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

Getting started

Run:

meteor add joshowens:accounts-entry

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

We wanted something to work with that used Iron Router, Bootstrap 3, and didn't require the forcing of the dropdown box that didn't seem to be easily styled. But we love the ease of adding more packages like accounts-facebook or accounts-twitter, so we fully support the OAuth packages by adding buttons to let people sign-up/sign-in with those services if you add them. By default, accounts-entry doesn't offer email/password login functionality. If you meteor add accounts-password, accounts-entry will offer your users the option to sign-up/sign-in with a username and password.

Example

Examples of the package in action (check out the sign up or sign in links):

Changelog

Compatibility

accounts-entry is presently compatible with Iron Router 1.0.3 and above.

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 {{ special }} helper we provide to give you the apppropriate links for signed-in/signed-out users. The {{ special }} 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:

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

Setting up password login

Use mrt 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'
      passwordSignupFields: 'EMAIL_ONLY'
      showSignupCode: true
      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
      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
       }]
       fluidLayout: false               // Set to true to use bootstrap3 container-fluid and row-fluid classes.
       useContainer: true               // Set to false to use an unstyled "accounts-entry-container" class instead of a bootstrap3 "container" or "container-fluid" class. 
       signInAfterRegistration: true    // Set to false to avoid prevent users being automatically signed up upon sign-up e.g. to wait until their email has been verified. 
       emailVerificationPendingRoute: '/verification-pending' // The route to which users should be directed after sign-up. Only relevant if signInAfterRegistration is false.
       showSpinner: true                // Show the spinner when the client is talking to the server (spin.js)
       spinnerOptions: { color: "#000", top: "80%" } // options as per [spin.js](http://fgnass.github.io/spin.js/)

    });
  });

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
      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).

Interested in building a quick meteor app that starts with Accounts-Entry?

We've created a meteor-boilerplate repo that you can clone as a starting point for an app. It follows all our standards that we use for building apps for our clients.

accounts-entry's People

Contributors

alesvaupotic avatar alethes avatar ameagher avatar art1sec8 avatar benmgreene avatar bshardi avatar cfly15 avatar cunneen avatar dandv avatar dkoo761 avatar eahefnawy avatar fix avatar gaborpop avatar hellogerard avatar jakubbilko avatar musgravejw avatar noamyoungerm avatar pahans avatar pavel-kurnosov avatar pwldp avatar queso avatar rgoomar avatar robertlowe avatar ryw avatar scole96 avatar seriousm avatar softwarerero avatar spencercarli avatar splendido avatar timbrandin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accounts-entry's Issues

Add example app at /example

So that it's easier to test changes to the package without having to include it in a real development app.

And it'd be nice for new users.

RFC: i18n for accounts-base

The accounts-base package unfortunately does not throw error codes but english texts in case of an error. This is not directly accounts-entry's problem but we could work around it. There are a few calls to Session.set('entryError', error.reason) which could be replaced by Session.set('entryError', (i18n err.reason.replace ".", "") || err.reason) and a translation could be provided like "Email already exists": "Email ya existe".

Do you think it makes sence to have this in accounts-entry? Should a provide a pull request for this?

Can't tell email is optional using USERNAME_AND_OPTIONAL_EMAIL

It would be great if there was some way to tell that email is optional while using:

Accounts.ui.config({
    passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL'
});

Previously, I was adding a placeholder value to the email input field but this modification would be lost each time I updated the package.

Is this change possible or is there a better workaround you could advise me of?

Thanks

Uncaught ReferenceError: loginButtonsSession is not defined

I got accounts-entry working with accounts-password, then tried adding accounts-facebook accounts-google and accounts-twitter.

Now I get error Uncaught ReferenceError: loginButtonsSession is not defined

I see some FIX THIS comments at the lines...

@queso thoughts? fix?

Less obtrusive Session variable names

First off, great job on this package. It's really nice once I got it going. One suggestion I have is to use less obtrusive Session variables. Names like 'error' are likely to be used often. Something more like 'accounts-entry.errors' is what I would suggest.

Remember route after sign in

See: https://groups.google.com/forum/?hl=en#!topic/meteor-talk/cAVKlVmBEYQ

I'd like to build in functionality so this "just works" across any of my projects, I can't think of scenarios where I'd not want to return the user to the page they tried to access.

I'm thinking accounts-entry might be the right level to implement this feature.

Agree this belongs in accounts-entry?

We could make this a config variable if some of you might not want the behavior.

No way to enter the email during signup

This only happens on signup, during sign-in the field is shown.
The element just simply does not exists, also not in the DOM tree.

Btw, the icons are also not shown - the css does not contain any url information.

image

image

I hope you can help me out here!
Nevertheless, you did a great job, it just looks nice and fits perfect to bootstrap3 theme.

Cheers!

entryLogo or settings.logo to set logo?

Hi, guys!

About getting logos, which one will it be? Sign-up and Sign-in use Accounts.settings.logo while Forgot-password and Reset-password both use Meteor.call('entryLogo'). Any special functionality behind it, about which I have no knowledge? I don't see where entryLogo comes from ...

USERNAME_AND_OPTIONAL_EMAIL breaks sign-in after sign-up

In the case where USERNAME_AND_OPTIONAL_EMAIL is enabled, and the user signs up without an email address, they fail to sign in automatically, as it tries to login using a non-existent email.

Removing USERNAME_AND_OPTIONAL_EMAIL from signUp.coffee line 125 fixes this.

Sign up / sign in form not rendering properly - v0.5.x

hi,

My sign up / sign in forms are not rendering properly when I upgrade from v0.4.4 to v0.5.x:

image

here is my configurations in models/accounts.js:

if(Meteor.isClient){
    Accounts.ui.config({
      passwordSignupFields: 'USERNAME_AND_EMAIL'
    });

    AccountsEntry.config({
        dashboardRoute: '/dashboard',
        homeRoute: '/',
        privacyUrl: '/privacy-policy',
        termsUrl: '/terms-of-use'
    })
};

if(Meteor.isServer){
    Meteor.startup(function(){
            
    })

}

The form renders properly on 0.4.4 under the same configurations though:

image

How can i fix this?

Creating accounts-entry-semantic

I would like to make accounts-entry work with semantic-ui
@matteodem created a great package called ogno-admin, and in that direction i would like to port accounts-entry to semantic-ui
what do you think? is that alright? :)

change password feature

hello , great work on this package!

i think right now the package is missing the 'change-password' feature that is present in accounts-ui though. Unlike in accounts-ui dropdown menu, there's no way for the user to change his password after he sign in. If he wants to change his password he has to logout, go through the forgot password & reset password process before he gets to change his password.

any chance change password can be rolled out? thank you!

"otherLoginServices" helper missing

I have just updated my project and found that otherLoginServices helper, which is used on the sign in page, is missing. In a previous version it was declared in the sign-up.coffee file.

Could you please have a look at it?
Cheers,
Laszlo

Does not show username when passwordSignupFields: 'USERNAME_AND_EMAIL'

Modified /client/accounts/accounts.coffee as follows and accounts-entry front end does not show username field but still just shows email field.

Meteor.startup ->
Accounts.ui.config
passwordSignupFields: 'USERNAME_AND_EMAIL'

AccountsEntry.config
privacyUrl: '/privacy'
termsUrl: '/terms'
homeRoute: '/'
dashboardRoute: '/dashboard'
profileRoute: '/profile'
language: 'en'
showSignupCode: false

Password/Email restrictions are enforced at the view layer

Password, and email validators shouldn't validate inside the the signUp.coffee, or at least it should be configurable.

Ideally the model layer in meteor would allow us to define something like:

Meteor.users.allow.insert = ()->
  if this.email != "win"
     throw new Error("view could handle this instead")

Perhaps it's possible to piggy back on autoforms validations.

Or something else, my point is that it's odd to have rules for this in one place but not globally applied.

Cheers

PS: Sorry for all the issues today D:

Signup code

This package is really useful, but I'm having some problems with the Signup code.

I'm using this code on the client:
Meteor.startup(function() {
Accounts.ui.config({
passwordSignupFields: 'USERNAME_AND_EMAIL'
});

AccountsEntry.config({
    dashboardRoute:'/',
    showSignupCode: true,
});

});

And this on the server:
Meteor.startup(function() {
AccountsEntry.config ({
signupCode: 's3cr3t'
});
});

But the signup works with any signupCode.

Add social auth service to existing account instead of creating new account

If a user signs up in an AE-powered Meteor app with email/password and then tries to sign in later with a social auth service like Facebook (and assuming their Facebook account is using the same email address as they used when creating their account in the Meteor app) then we should add the social auth service to the 'services' collection in their 'users' document instead of creating a new 'users' document. This will allow them to then sign in to the Meteor app with either email/password or their social auth button.

This is very useful because, in my experience, many users forget if they signed up for an app with email or a social auth so they may not use the same login method each time and we don't want to be creating new accounts for them just because they signed in using a different auth mechanism.

Of course, if their Facebook account has a different email address than the one they used when signing up for the Meteor app then we have no way of linking the two accounts. So in that case, we should go ahead and create a new account like we do today. Likewise for any other social auth provider.

error messages not cleared after you switch routes

hi there.

the problem i'm facing is when the user goes on the sign in form, type his username and discovered 'User not found'. Then when he clicks the sign up link, the form still shows the same error 'User not found'. The error is not cleared.

When I dug into the source, I saw Session.set('entryError', undefined) on the 'before' calls. Strangely, it doesn't seem to be clearing the session variable.

I've double checked the issue is the same on your meteor-boilerplate app > github.differential.io/meteor-boilerplate/

accounts-ui is still a dependency

Looks like the only remnant of accounts-ui is that we are looking for configuration variables from it still. We should change that so accounts-ui package can be removed from apps

Support sites with usernames

Support passwordSignupFields in Accounts.ui.config

  • 'USERNAME_AND_EMAIL'
  • 'USERNAME_AND_OPTIONAL_EMAIL'
  • 'USERNAME_ONLY'
  • 'EMAIL_ONLY' (default)

attempt to use accounts-entry from new project (v boilerplate) yields no email-address field in sign-up

hi,

i'm trying to use accounts-entry from a new project while using most things from meteor-boilerplate.

i was thinking i might want to use meteorite/atmosphere for bootstrap/font-awesome packages v starting with them embedded as stock boilerplate does.

i copied over all 'visible' files from boilerplate, but the sign-up form doesn't show an input field for email-address, only password.

i'm thinking something in the .meteor folder perhaps, but figured i'd run it past the pros.

regards,
tony.

0.5.1 is broken

@queso

The build you just pushed appears to be broken.

I tested on two different OSX installs, one in an isolated brand new vm only used for meteor.

  Users-MacBook-Pro:~ user$ git clone https://github.com/BeDifferential/meteor-boilerplate.git
  Cloning into 'meteor-boilerplate'...
  remote: Reusing existing pack: 421, done.
  remote: Total 421 (delta 0), reused 0 (delta 0)
  Receiving objects: 100% (421/421), 600.61 KiB, done.
  Resolving deltas: 100% (155/155), done.
  Users-MacBook-Pro:~ user$ cd meteor-boilerplate/
  Users-MacBook-Pro:meteor-boilerplate user$ ls
  README.md collections routes.coffee   smart.json
  client        public      server
  Users-MacBook-Pro:meteor-boilerplate user$ mrt

  Stand back while Meteorite does its thing
  ✓ iron-router
      tag: https://github.com/EventedMind/iron-router.git#v0.6.2
  ✓ accounts-entry
      tag: https://github.com/BeDifferential/accounts-entry.git#v0.5.1
  ✓ handlebars-server
      tag: https://github.com/EventedMind/meteor-handlebars-server.git#v1.1.0
  ✓ just-i18n
      tag: https://github.com/subhog/meteor-just-i18n.git#v0.1.1
  ✓ headers
      tag: https://github.com/gadicohen/meteor-headers.git#v0.0.13

  Done installing smart packages

  Ok, everything's ready. Here comes Meteor!

  Installing Meteor 0.7.0.1:
   * 'meteor' build tool (version 09b63f1ed5)
   * Package updates: accounts-base accounts-facebook accounts-github
     accounts-google accounts-meetup accounts-oauth accounts-password
     accounts-twitter accounts-ui accounts-ui-unstyled accounts-weibo amplify
     appcache application-configuration audit-argument-checks autopublish
     autoupdate backbone bootstrap browser-policy browser-policy-common
     browser-policy-content browser-policy-framing check code-prettify
     coffeescript coffeescript-test-helper ctl ctl-helper d3 deps
     dev-bundle-fetcher disable-oplog domutils ejson email facebook facts
     follower-livedata force-ssl geojson-utils github google handlebars htmljs
     http insecure jquery jquery-history jquery-layout jquery-waypoints
     js-analyze-tests json jsparse less livedata liverange localstorage logging
     madewith meetup meteor meyerweb-reset minifiers minimongo mongo-livedata
     oauth oauth1 oauth2 ordered-dict preserve-inputs random reactive-dict reload
     routepolicy service-configuration session showdown spark spiderable srp
     standard-app-packages star-translate startup stylus templating test-helpers
     test-in-browser test-in-console tinytest twitter underscore universal-events
     webapp weibo

  [[[[[ ~/meteor-boilerplate ]]]]]


  => Meteor 0.7.0.1: Fix failure to initialize local MongoDB server.

     This release is being downloaded in the background. Update your
     project to Meteor 0.7.0.1 by running 'meteor update'.


  => Meteor 0.7.0.1 is available. Update this project with 'meteor update'.
  iron-router: updating npm dependencies -- connect...
  headers: updating npm dependencies -- connect...
  handlebars-server: updating npm dependencies -- handlebars...
  => Meteor server running on: http://localhost:3000/

And the browser console:

  Uncaught ReferenceError: __headers__ is not defined headers-client.js:54
  Uncaught TypeError: Cannot read property 'headers' of undefined accounts-entry.js:35
  Uncaught TypeError: Cannot read property 'AccountsEntry' of undefined global-imports.js:7
  Uncaught ReferenceError: Template is not defined template.dashboard.js:1
  Uncaught ReferenceError: Template is not defined template.home.js:1
  Uncaught ReferenceError: Template is not defined template.footer.js:1
  Uncaught ReferenceError: Template is not defined template.header.js:1
  Uncaught ReferenceError: Template is not defined template.index.js:1
  Uncaught ReferenceError: Template is not defined template.loading.js:1
  Uncaught ReferenceError: Template is not defined home.coffee.js:2
  Uncaught ReferenceError: Meteor is not defined accounts.coffee.js:2
  event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
  Uncaught Error: Uh oh, no template found named "layout" page_manager.js:19

Everything is exploding! Can we find the regression, it appears related to headers.

Password reset form lacks validation

"7 character minimum password. Password must have at least one digit." is currently enforced on account creation but not when a user sets a new password (after requesting a recovery link).

Customize UI Template

Maybe someone else has pointed to this already, is there a way to customize the template for this packages, i would like to remove the sign up button in the sign-in template and change the markup a bit ?

Thanks

Incorrect routing on sign-in

Currently the sign-in code is as follows:

Template.entrySignIn.events
'submit #signIn': (event) ->
event.preventDefault()
Session.set('email', $('input[name="email"]').val())
Session.set('password', $('input[name="password"]').val())

Meteor.loginWithPassword(Session.get('email'), Session.get('password'), (error)->
  if error
    Session.set('entryError', error.reason)
  else
    Router.go('/')
)

Shouldn't that Router.go('/') be:
Router.go Session.get('entrySettings').dashboardRoute
?

sendVerificationEmail not sending the verification email

This is probably not an issue and it is just that I don't understand this part of the package well enough, but I am trying to send a verification email to a user who signs up with their email address. I enter the following code on the server:

Accounts.config({
sendVerificationEmail: true,
forbidClientAccountCreation: false
});

On multiple sites, people have posted that this works for them with the accounts-ui package but I couldn't get it to work with accounts-entry. Also, once this is working, is there any other code that I need to add to accept the verification once the user clicks the link in their email?

Thanks!

Incorrect routing in social login

In shared/social.coffee on line 14, I think you wanted something like

Router.go (Session.get 'entrySettings').dashboardRoute

instead of

Router.go(Meteor.call('entryDashboardRoute'))

With thanks,
Laszlo

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.