From 0e2f26047b7597ac7d412429324e656cc8eb7766 Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Tue, 30 Jun 2015 22:26:57 -0400 Subject: [PATCH 1/9] Initial commit of new flow-based package --- .travis.yml | 11 -- CHANGELOG.md | 173 ------------------ LICENSE | 2 +- README.md | 136 ++------------ client/entry.coffee | 17 +- .../views/enrollAccount/enrollAccount.coffee | 2 +- .../forgotPassword/forgotPassword.coffee | 2 +- .../views/resetPassword/resetPassword.coffee | 2 +- client/views/signIn/signIn.coffee | 4 +- client/views/signUp/signUp.coffee | 6 +- client/views/social/social.coffee | 4 +- package.js | 38 ++-- shared/router.coffee | 105 ----------- shared/router.js | 151 +++++++++++++++ tests/client.coffee | 50 ----- tests/client.html | 15 -- tests/route.coffee | 3 - tests/server.coffee | 1 - 18 files changed, 204 insertions(+), 518 deletions(-) delete mode 100644 .travis.yml delete mode 100644 CHANGELOG.md delete mode 100644 shared/router.coffee create mode 100644 shared/router.js delete mode 100644 tests/client.coffee delete mode 100644 tests/client.html delete mode 100644 tests/route.coffee delete mode 100644 tests/server.coffee diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eeea09fa..00000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: objective-c -node_js: - - "0.10" -before_install: - # Install phantomjs - - wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-macosx.zip - - unzip phantomjs-2.0.0-macosx.zip - - export PATH="`pwd`/phantomjs-2.0.0-macosx/bin:${PATH}" - # Run Arunoda's script - - "curl -L http://git.io/ejPSng | /bin/sh" -script: "make test" diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 6ec5afbb..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -layout: default -username: Differential -repo: accounts-entry -desc: Meteor sign up and sign in pages. -version: 0.8.0 - ---- -# Changelog - -### 0.8.0 - -* Support email verification sending for accounts-password. Fixes #75. Fixes #190. [8540eb5](http://github.com/Differential/accounts-entry/commit/8540eb5fa5a3fdbdc729f2f74e72c9397e66ce37) -* Hash passwords client-side before they go over the wire. [f53c7c8](http://github.com/Differential/accounts-entry/commit/f53c7c8a5bc3c3589d4b54fac47c50028345e06d) -* added arabic translation [3a2fa7b](http://github.com/Differential/accounts-entry/commit/3a2fa7b4c38cdcf866f403fa45d97743b45412ec) -* added russian translation [4b106e3](http://github.com/Differential/accounts-entry/commit/4b106e3dadcc4638232bcca01d61a2e44ab50346) -* Add a profile helper to accountButtons helper methods [7c41760](http://github.com/Differential/accounts-entry/commit/7c4176085d170f4fb15077f4a73c8d2fdaaecf7b) -* added current route to fromWhere session var [94aafc5](http://github.com/Differential/accounts-entry/commit/94aafc54f7932c29e92b5f3522e97c0346d74731) -* Add profile to server account create user [d78ed24](http://github.com/Differential/accounts-entry/commit/d78ed248fbc6926145cc4d47888edbf3d0ba521c) -* updated buttonText helper [31a5917](http://github.com/Differential/accounts-entry/commit/31a5917278a690f9d21918061a759905d48d7c89) -* redirect user from sign-in if already signed in [8e952fb](http://github.com/Differential/accounts-entry/commit/8e952fb16f5ef8fa031f0bc51103f01f974b2bf5) -* changed social signUp usage [faea789](http://github.com/Differential/accounts-entry/commit/faea7893ae767384351924114112131db700c295) -* updated english language sign-up terms [9b774f1](http://github.com/Differential/accounts-entry/commit/9b774f1e5cafbeb3e33421a4f6bb7743d4735995) -* Add showOtherLoginServices option [a3b61e7](http://github.com/Differential/accounts-entry/commit/a3b61e7900ffb2bbf75427478dad1dfe32f44288) -* Allow template override using signedInTemplate [eaca425](http://github.com/Differential/accounts-entry/commit/eaca425e3a11e8d3fb4d3dc54d7f8ac8081be9a0) -* Added translation for "Email is required" [8249664](http://github.com/Differential/accounts-entry/commit/8249664d5a11362fb2407c2a9ccca0c11ee7cc22) -* Added t9n on error message [3af877b](http://github.com/Differential/accounts-entry/commit/3af877b1e2a0e9f48cf30ef7b9df20cd02afe598) -* Added translation for "User not found" to error: [5e8aaea](http://github.com/Differential/accounts-entry/commit/5e8aaea6dcbb0bddfc1a653b1b48274692783f1d) -* Translation for "Email already exists." [89feeba](http://github.com/Differential/accounts-entry/commit/89feeba821ee91ed7cff865394118d24725e63e7) -* Updated male/female addressing messages [6c26f20](http://github.com/Differential/accounts-entry/commit/6c26f20776580f047b189ce691eeb7106a88cb56) -* Added Incorrect password translation [ddeb56a](http://github.com/Differential/accounts-entry/commit/ddeb56a21874a4c7db9363d45b2a614a5d8b54fb) -* added slovene language [6ddaea2](http://github.com/Differential/accounts-entry/commit/6ddaea29d2c9062e43cceed62d7fe8f72e5d8e98) -* Add extra signup field support. [Fixes #179] [ea0667e](http://github.com/Differential/accounts-entry/commit/ea0667ea03aea3c17ca5093632513b590e38b5af) -* Get meteor developer accounts working a bit better. [be97ac8](http://github.com/Differential/accounts-entry/commit/be97ac850259018b3fedca3d41dee5ca2cc98bc6) -* added support for Portuguese. [d069af4](http://github.com/Differential/accounts-entry/commit/d069af48d2663ce91c2010f931d7bacd978395d8) -* added correct jquery selector for getting the entry [589f668](http://github.com/Differential/accounts-entry/commit/589f668ceaed838a167dcce1eddd0b599c74825e) -* Added support for Swedish. [28a4bc9](http://github.com/Differential/accounts-entry/commit/28a4bc9b5fe069187a5e1d011727daba0a8a9cfb) -* Pause is now a function passed to the onBeforeAction method. [b3a8a6d](http://github.com/Differential/accounts-entry/commit/b3a8a6d094e018ed90d53a2b1b9bfe233bdb3e43) -* Support Meteor accounts forbidClientAccountCreation. [4b64116](http://github.com/Differential/accounts-entry/commit/4b64116e05a419ba3448a7e4786ebb54d535933d) -* audit argument package support [256d5ef](http://github.com/Differential/accounts-entry/commit/256d5ef96a0ca53e5d8ec5beaa53ef71d52b353d) -* updating #143 which attempts to correct error #130 [09aaddd](http://github.com/Differential/accounts-entry/commit/09aaddd0651b72e13e3d20ebeee54b49e0c7ff5f) -* added italian translation [e8f5e68](http://github.com/Differential/accounts-entry/commit/e8f5e68183e42d247d331b95c3ab681fa6f45182) -* Update german.coffee [461991a](http://github.com/Differential/accounts-entry/commit/461991a37d6dcefe6f344e1382c8311a0b6339eb) - -### 0.7.0 - -* Do not pull in spark or just-i18n dependencies, neither are directly needed anymore. [fc994c1](https://github.com/BeDifferential/accounts-entry/commit/fc994c1afe10dfcbb54b7aae2b0cf9fc5ba1f5b6) -* Add name attributes on signUp form to be consistent [#107](https://github.com/BeDifferential/accounts-entry/pull/107) -* Add emailToLower and usernameToLower settings so you can set the package to lowercase email input [#101](https://github.com/BeDifferential/accounts-entry/pull/101) -* Put autofocus on first field, not just on the email input. [#106](https://github.com/BeDifferential/accounts-entry/pull/106) -* Include the wrapLinks html, duh [7fb0e8e](http://github.com/Differential/accounts-entry/commit/7fb0e8e745852feb441661285207302bfa1e8441) -* Clean up wrapLinks for blaze, clean up test syntax now that include works, and add a new wrapLinks test. [7a3296c](http://github.com/Differential/accounts-entry/commit/7a3296cb044fe8c235fce0eab13f490456d67e6a) -* Fix tests to work with blaze now. [9966e90](http://github.com/Differential/accounts-entry/commit/9966e903ac7a53c391786ef475419e8e226cef21) -* Use the released version of just-i18n [d3d5185](http://github.com/Differential/accounts-entry/commit/d3d5185c5792db14050208e72dc167d97a42d943) -* redirect to correct page after social login [8aecc9c](http://github.com/Differential/accounts-entry/commit/8aecc9cc7a1865d43c895a84a36586a41c880d64) -* Oops, comma [77d7227](http://github.com/Differential/accounts-entry/commit/77d72275e54e3583294c15d915d5e1a6bc468e10) -* Try to fix accounts-t9n issues. [df238e8](http://github.com/Differential/accounts-entry/commit/df238e82dcb898fa3f3f8247743013ac08525f66) -* Fix just-i18n issues. Fixes #109 [c6daa42](http://github.com/Differential/accounts-entry/commit/c6daa42730a9001cbb166fb22a6f7b99e05a03c5) -* Adding ability to override accountButtons signup [4e82743](http://github.com/Differential/accounts-entry/commit/4e82743377ffd8abb153f1c59fc7afd7cf058be4) -* added sublime project files to gitignore and fix autofocus [9b10992](http://github.com/Differential/accounts-entry/commit/9b109922b54fd39c5284c91c9f1091dcaadab4d6) -* Changing setting name to usernameToLower and emailToLower, just struggled with insensitive and casesensitive keeping what they ment in my head, i think this is clearer [962a7c5](http://github.com/Differential/accounts-entry/commit/962a7c59fe40f121cb05bd4a391f3769cf96f375) -* Adding isStringEmail method to AccountsEntry [bafe044](http://github.com/Differential/accounts-entry/commit/bafe044bd564398e0cb342752caee6673c6a46c3) -* Adding check to make sure username is not an email address [398065d](http://github.com/Differential/accounts-entry/commit/398065d60f92680d8b251d18a2a5b46677be4f28) -* Adding error.usernameIsEmail to i18n, error text for different languages need check [c7ce0f6](http://github.com/Differential/accounts-entry/commit/c7ce0f68aa54dd6fca9b1005958be1e09204556d) -* Adding new settings for username and email Insensitive, adding check to signUp to make the username and email insensitive if needed [c5cbb06](http://github.com/Differential/accounts-entry/commit/c5cbb06489abb6360375d3f395cf5604d00d3385) - -### 0.6.2 - -* Lock just-i18n to v0.1.1 since the refactors seem to break accounts-t9n which we rely on. [a58632](https://github.com/BeDifferential/accounts-entry/commit/a58632e95c0c59e72dd6edce71fa58fe50e8ce94) -* Fix signup form to work with USERNAME_ONLY, email field was causing errors. [#93](https://github.com/BeDifferential/accounts-entry/issues/93) -* Fix 'fromWhere' routing to work for both usernames and emails, was an oversight [#100](https://github.com/BeDifferential/accounts-entry/pull/100) -* Add polish translations [#90](https://github.com/BeDifferential/accounts-entry/pull/90) - -### 0.6.1 - -* Bump iron-router version to 0.6.4. Still wish we had semvar support for dependencies [#96](https://github.com/BeDifferential/accounts-entry/issues/96) - -### 0.6.0 - -* Added first tests using TinyTest -* Switch to using t9n so we get wrapped up translations for Meteor Core accounts-base errors [#86](https://github.com/BeDifferential/accounts-entry/pull/86) -* Track redirects because of signInRequired and redirect back once sign in/sign up is completed [#13](https://github.com/BeDifferential/accounts-entry/issues/13) -* Added signInRequired helper method -* Fixed various langauge issues with translations [6086a1](https://github.com/BeDifferential/accounts-entry/commit/6086a17a3d3fe7fd1d4f2ab71d0ed9553756b1f0) -* Usernames in sign up + sign in should not be case sensitive [#65](https://github.com/BeDifferential/accounts-entry/issues/65) -* Add before hooks to the settings so you can tweak html before each accountButtons link (NEEDS DOCS) [8b9555](https://github.com/BeDifferential/accounts-entry/commit/8b9555ed33827fa16d15191377de5e8256be749e) -* Fix template override to work correctly [#83](https://github.com/BeDifferential/accounts-entry/issues/83) -* Fix redirect happening before login is finished processing [#78](https://github.com/BeDifferential/accounts-entry/pull/78) -* Sign up code was being required by faulty logic, make it optional now. [#69](https://github.com/BeDifferential/accounts-entry/issues/69) -* Add missed translations [cd7192](https://github.com/BeDifferential/accounts-entry/commit/cd719282796e76f1c431e526d650238af6da622d) -* Add german support [#70](https://github.com/BeDifferential/accounts-entry/pull/70) - -### 0.5.3 - -### 0.5.2 - -### 0.5.1 - -### 0.5.0 - -* Use Accounts.createUser call instead of our own [c2b2cf](https://github.com/BeDifferential/accounts-entry/commit/c2b2cfca0be407cb90b8575a9c794549b0c5dbb3) -* Fix calls to use proper settings for logo now [#47](https://github.com/BeDifferential/accounts-entry/issues/47) -* Switch package to use i18n and add english and spanish translations [#46](https://github.com/BeDifferential/accounts-entry/pull/46) -* Allow signupTemplate to be overridden [ad0381d](https://github.com/BeDifferential/accounts-entry/commit/ad0381d3fa80aa2247b9d6200d4489f1fd3430c8) -* Refactor the folder structure of the package [ad0381d](https://github.com/BeDifferential/accounts-entry/commit/ad0381d3fa80aa2247b9d6200d4489f1fd3430c8) -* Add an optional placeholder if email is marked as optional in the config. [#39](https://github.com/BeDifferential/accounts-entry/pull/39) - -### v0.4.4 - -* Switch to our own reset-password setup in IronRouter -* Tweaked wording on forgot password header - -### v0.4.3 - -* Update to IronRouter 0.6.1 -* Switch to Font-Awesome 4.0 syntax -* More IronRouter syntax changes -* Fix typo in register handlebars helper -* Return a string instead of a route from the helper - -### v0.4.2 - -* Fixed bug with missing helper (otherServicesLogin) on signup page. - -### v0.4.1 - -* Change version of iron-router we are pulling in, now use 0.6.0 - -### v0.4.0 - -* Change configuration to be partially on client, partially on server. - There were issues with getting the Session set based on a Meteor.call - with the previous implementation, so most settings are back on the - client, only signupCode and defaultProfile are set on server now. -* Fixes bug to allow signup without signupCode - -### v0.3.1 - -* Fix various router redirects to use variables set in the config instead of hardcodings [#25](https://github.com/BeDifferential/accounts-entry/issues/25) and [#26](https://github.com/BeDifferential/accounts-entry/issues/26) - -### v0.3.0 - -* Fix client side login to happen after we create the user server side [#24](https://github.com/BeDifferential/accounts-entry/issues/24) -* Fix an issue with event passing and Firefox/IE issues [#23](https://github.com/BeDifferential/accounts-entry/issues/23) -* Optionally protect signup form with a signup code -* Move configuration to server -* Configuration is set by calling a method rather than setting an - attribute of AccountsEntry object - -### v0.2.10 - -* Add a sign out route via iron router (/sign-out) -* Make signedInAs a global helper instead of just in the accountButtons template - -### v0.2.9 - -* Return a string instead of true for the username on signup - -### v0.2.8 - -* Fix css targetting for signout link changes - -### v0.2.7 - -* Make Sign In header tag consistent with rest of package - -### v0.2.6 - -* Move create account header outside of the if logic so you see the header no matter what your settings. - -### v0.2.5 - -* Removed more differential naming from the package diff --git a/LICENSE b/LICENSE index 869e61e1..a8096715 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 Differential +Copyright (c) 2015 Dov Rosenberg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 436dcec4..ecf115f8 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,14 @@ -[![Stories in Ready](https://badge.waffle.io/Differential/accounts-entry.png?label=ready&title=Ready)](https://waffle.io/Differential/accounts-entry) -# Meteor accounts-entry [![Build Status](https://travis-ci.org/Differential/accounts-entry.png)](https://travis-ci.org/Differential/accounts-entry) - -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. +This is a fork of joshowens:accounts-entry which uses Flow Router instead of Iron Router. ## Getting started -Run: +Install: ``` -meteor add joshowens:accounts-entry +meteor add dovrosenberg:accounts-entry-flow ``` -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](https://github.com/EventedMind/iron-router), -[Bootstrap 3](https://github.com/mangasocial/meteor-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](http://github.differential.com/accounts-entry/images/Example.png) - -Examples of the package in action (check out the sign up or sign in -links): - -* [https://linklyapp.com/](https://linklyapp.com/) -* [https://carp.io/](https://carp.io/) -* [https://getliquid.io/](https://getliquid.io/) -* [http://support.unpolishedcr.com/](http://support.unpolishedcr.com/) -* Submit PR with a description to add your project to the list. - -[Changelog](https://github.com/BeDifferential/accounts-entry/blob/master/CHANGELOG.md) - -## Compatibility - -accounts-entry is presently compatible with Iron Router 1.0.3 and above. +See the [original](https://github.com/Differential/accounts-entry) package for more details on usage and examples. The differences are described here: ## Provided routes @@ -51,98 +26,19 @@ You can then either add links to those directly, or use the `{{ special }}` help ## 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. +Use the helper function AccountsEntrySignInRequired in an entry trigger for any route that requires users to be signed in. This will 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: +Here is a route example: ````js - this.route('userProfile', { - path: '/profile', - template: 'profile', - onBeforeAction: function () { - AccountsEntry.signInRequired(this); - } - }); +FlowRouter.route('/dashboard', { + name: 'dashboard', + triggersEnter: [ + AccountsEntrySignInRequired + ], + action: function(params) { + FlowLayout.render('dashboard'); + } + } +); ```` - -## 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. - -```js - 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: - -```js - 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: - -```js - wrapLinks: true // wraps accounts-entry links in
  • 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](http://github.differential.com/meteor-boilerplate/) 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. diff --git a/client/entry.coffee b/client/entry.coffee index 1274e738..0044c9b3 100644 --- a/client/entry.coffee +++ b/client/entry.coffee @@ -31,19 +31,14 @@ AccountsEntry = signUpRoute = Router.routes['entrySignUp'] signUpRoute.options.template = appConfig.signUpTemplate - signInRequired: (router, extraCondition) -> - extraCondition ?= true - unless Meteor.loggingIn() - if Meteor.user() and extraCondition - router.next() - else - Session.set('fromWhere', router.url) - Router.go('/sign-in') - Session.set('entryError', t9n('error.signInRequired')) - router.next() - @AccountsEntry = AccountsEntry +AccountsEntrySignInRequired = (context, redirect) -> + unless Meteor.loggingIn() + unless Meteor.user() + Session.set('fromWhere', context.path) + redirect('/sign-in') + Session.set('entryError', t9n('error.signInRequired')) class @T9NHelper diff --git a/client/views/enrollAccount/enrollAccount.coffee b/client/views/enrollAccount/enrollAccount.coffee index 1e5bc725..01eea0fd 100644 --- a/client/views/enrollAccount/enrollAccount.coffee +++ b/client/views/enrollAccount/enrollAccount.coffee @@ -37,4 +37,4 @@ Template.entryEnrollAccount.events Session.set('entryError', (error.reason || "Unknown error")) else Session.set('resetToken', null) - Router.go AccountsEntry.settings.dashboardRoute + FlowRouter.go AccountsEntry.settings.dashboardRoute diff --git a/client/views/forgotPassword/forgotPassword.coffee b/client/views/forgotPassword/forgotPassword.coffee index 8413b504..db2d202a 100644 --- a/client/views/forgotPassword/forgotPassword.coffee +++ b/client/views/forgotPassword/forgotPassword.coffee @@ -21,5 +21,5 @@ Template.entryForgotPassword.events if error Session.set('entryError', error.reason) else - Router.go AccountsEntry.settings.homeRoute + FlowRouter.go AccountsEntry.settings.homeRoute ) diff --git a/client/views/resetPassword/resetPassword.coffee b/client/views/resetPassword/resetPassword.coffee index 352a0225..e7169053 100644 --- a/client/views/resetPassword/resetPassword.coffee +++ b/client/views/resetPassword/resetPassword.coffee @@ -39,4 +39,4 @@ Template.entryResetPassword.events Session.set('entryError', (error.reason || "Unknown error")) else Session.set('resetToken', null) - Router.go AccountsEntry.settings.dashboardRoute + FlowRouter.go AccountsEntry.settings.dashboardRoute diff --git a/client/views/signIn/signIn.coffee b/client/views/signIn/signIn.coffee index 8abf60a1..7c459c45 100644 --- a/client/views/signIn/signIn.coffee +++ b/client/views/signIn/signIn.coffee @@ -45,10 +45,10 @@ AccountsEntry.entrySignInEvents = { if error T9NHelper.accountsError error else if Session.get('fromWhere') - Router.go Session.get('fromWhere') + FlowRouter.go Session.get('fromWhere') Session.set('fromWhere', undefined) else - Router.go AccountsEntry.settings.dashboardRoute + FlowRouter.go AccountsEntry.settings.dashboardRoute ) } diff --git a/client/views/signUp/signUp.coffee b/client/views/signUp/signUp.coffee index 77c47a58..71714852 100644 --- a/client/views/signUp/signUp.coffee +++ b/client/views/signUp/signUp.coffee @@ -160,14 +160,14 @@ AccountsEntry.entrySignUpEvents = { console.log error T9NHelper.accountsError error else if Session.get 'fromWhere' - Router.go Session.get('fromWhere') + FlowRouter.go Session.get('fromWhere') Session.set 'fromWhere', undefined else - Router.go AccountsEntry.settings.dashboardRoute + FlowRouter.go AccountsEntry.settings.dashboardRoute else if AccountsEntry.settings.emailVerificationPendingRoute - Router.go AccountsEntry.settings.emailVerificationPendingRoute + FlowRouter.go AccountsEntry.settings.emailVerificationPendingRoute else console.log err Session.set 'entryError', t9n("error.signupCodeIncorrect") diff --git a/client/views/social/social.coffee b/client/views/social/social.coffee index f51b49d6..f6d55361 100644 --- a/client/views/social/social.coffee +++ b/client/views/social/social.coffee @@ -30,10 +30,10 @@ Template.entrySocial.events Session.set 'talkingToServer', false if (!err) if Session.get('fromWhere') - Router.go Session.get('fromWhere') + FlowRouter.go Session.get('fromWhere') Session.set('fromWhere', undefined) else - Router.go AccountsEntry.settings.dashboardRoute + FlowRouter.go AccountsEntry.settings.dashboardRoute else if (err instanceof Accounts.LoginCancelledError) # do nothing else if (err instanceof ServiceConfiguration.ConfigError) diff --git a/package.js b/package.js index 8e01e399..7043b0cd 100644 --- a/package.js +++ b/package.js @@ -1,27 +1,28 @@ Package.describe({ - summary: "Make signin and signout their own pages with routes.", - version: '1.0.3', - name: "joshowens:accounts-entry", - githubUrl: 'https://github.com/Differential/accounts-entry', + name: "dovrosenberg:accounts-entry-flow", + version: '0.9.0', + summary: "Make signin and signout their own pages with routes.", + git: 'https://github.com/dovrosenberg/accounts-entry', + documentation: 'README.md' }); Package.onUse(function(api) { api.versionsFrom("METEOR@0.9.0"); - api.use(['iron:router@1.0.3', 'softwarerero:accounts-t9n@1.0.3', 'joshowens:simple-form@0.2.2', 'sacha:spin@2.0.4'], ['client', 'server']); + api.use(['meteorhacks:flow-router', 'softwarerero:accounts-t9n@1.0.3', 'joshowens:simple-form@0.2.2', 'sacha:spin@2.0.4'], ['client', 'server']); // CLIENT api.use([ - 'deps', - 'service-configuration', - 'accounts-base', - 'underscore', - 'templating', - 'handlebars', - 'session', - 'coffeescript', - 'less', - 'sha'] - , 'client'); + 'deps', + 'service-configuration', + 'accounts-base', + 'underscore', + 'templating', + 'handlebars', + 'session', + 'coffeescript', + 'less', + 'sha'], + 'client'); api.addFiles([ @@ -80,7 +81,8 @@ Package.onUse(function(api) { api.imply('accounts-base', ['client', 'server']); api.imply('accounts-password', ['client', 'server']); api.export('AccountsEntry', ['client', 'server']); - api.addFiles(['shared/router.coffee'], ['client', 'server']); + api.export('AccountsEntrySignInRequired', ['client', 'server']); + api.addFiles(['shared/router.js'], ['client', 'server']); }); @@ -93,7 +95,7 @@ Package.onTest(function (api) { 'mongo-livedata', 'coffeescript' ]); - api.use(['iron:router', 'softwarerero:accounts-t9n', 'joshowens:simple-form'], ['client', 'server']); + api.use(['meteorhacks:flow-router', 'softwarerero:accounts-t9n', 'joshowens:simple-form'], ['client', 'server']); api.use('joshowens:accounts-entry'); api.addFiles(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client'); diff --git a/shared/router.coffee b/shared/router.coffee deleted file mode 100644 index e0bc228b..00000000 --- a/shared/router.coffee +++ /dev/null @@ -1,105 +0,0 @@ -Router.map -> - - @route "entrySignIn", - path: "/sign-in" - onBeforeAction: -> - Session.set('entryError', undefined) - Session.set('buttonText', 'in') - @next() - onRun: -> - if Meteor.userId() - Router.go AccountsEntry.settings.dashboardRoute - - if AccountsEntry.settings.signInTemplate - @template = AccountsEntry.settings.signInTemplate - - # If the user has a custom template, and not using the helper, then - # maintain the package Javascript so that OpenGraph tags and share - # buttons still work. - pkgRendered= Template.entrySignIn.rendered - userRendered = Template[@template].rendered - - if userRendered - Template[@template].rendered = -> - pkgRendered.call(@) - userRendered.call(@) - else - Template[@template].rendered = pkgRendered - - Template[@template].events(AccountsEntry.entrySignInEvents) - Template[@template].helpers(AccountsEntry.entrySignInHelpers) - @next() - - - @route "entrySignUp", - path: "/sign-up" - onBeforeAction: -> - Session.set('entryError', undefined) - Session.set('buttonText', 'up') - @next() - onRun: -> - if AccountsEntry.settings.signUpTemplate - @template = AccountsEntry.settings.signUpTemplate - - # If the user has a custom template, and not using the helper, then - # maintain the package Javascript so that OpenGraph tags and share - # buttons still work. - pkgRendered= Template.entrySignUp.rendered - userRendered = Template[@template].rendered - - if userRendered - Template[@template].rendered = -> - pkgRendered.call(@) - userRendered.call(@) - else - Template[@template].rendered = pkgRendered - - Template[@template].events(AccountsEntry.entrySignUpEvents) - Template[@template].helpers(AccountsEntry.entrySignUpHelpers) - @next() - - - @route "entryForgotPassword", - path: "/forgot-password" - onBeforeAction: -> - Session.set('entryError', undefined) - @next() - - @route 'entrySignOut', - path: '/sign-out' - onBeforeAction: ()-> - Session.set('entryError', undefined) - if not AccountsEntry.settings.homeRoute - @next() - else - Meteor.logout () -> - Router.go AccountsEntry.settings.homeRoute - - @route 'entryVerificationPending', - path: '/verification-pending' - onBeforeAction: -> - Session.set('entryError', undefined) - @next() - - @route 'entryResetPassword', - path: 'reset-password/:resetToken' - onBeforeAction: -> - Session.set('entryError', undefined) - Session.set('resetToken', @params.resetToken) - @next() - - @route 'entryEnrollAccount', - path: 'enroll-account/:resetToken' - onBeforeAction: -> - Session.set('entryError', undefined) - Session.set('resetToken', @params.resetToken) - -# Get all the accounts-entry routes one time -exclusions = [] -_.each Router.routes, (route)-> - exclusions.push route.getName() -# Change the fromWhere session variable when you leave a path -Router.onStop -> - # If the route is an entry route, no need to save it - if (!_.contains(exclusions, Router.current().route?.getName())) - Session.set('fromWhere', window.location.pathname) diff --git a/shared/router.js b/shared/router.js new file mode 100644 index 00000000..92b47832 --- /dev/null +++ b/shared/router.js @@ -0,0 +1,151 @@ +FlowRouter.route('/sign-in', { + name: 'entrySignIn', + triggersEnter: [ + function(context, redirect) { + Session.set('entryError', undefined); + Session.set('buttonText', 'in'); + } + ], + action: function(params) { + var pkgRendered, userRendered; + + if (Meteor.userId()) { + redirect(AccountsEntry.settings.dashboardRoute); + } + if (AccountsEntry.settings.signInTemplate) { + this.template = AccountsEntry.settings.signInTemplate; + pkgRendered = Template.entrySignIn.rendered; + userRendered = Template[this.template].rendered; + if (userRendered) { + Template[this.template].rendered = function() { + pkgRendered.call(this); + return userRendered.call(this); + }; + } else { + Template[this.template].rendered = pkgRendered; + } + Template[this.template].events(AccountsEntry.entrySignInEvents); + Template[this.template].helpers(AccountsEntry.entrySignInHelpers); + } + FlowLayout.render('entrySignIn'); + } +}); + + +FlowRouter.route('/sign-up', { + name: 'entrySignUp', + triggersEnter: [ + function(context, redirect) { + Session.set('entryError', undefined); + Session.set('buttonText', 'up'); + } + ], + action: function(params) { + var pkgRendered, userRendered; + if (AccountsEntry.settings.signUpTemplate) { + this.template = AccountsEntry.settings.signUpTemplate; + + // If the user has a custom template, and not using the helper, then + // maintain the package Javascript so that OpenGraph tags and share + // buttons still work. + pkgRendered = Template.entrySignUp.rendered; + userRendered = Template[this.template].rendered; + + if (userRendered) { + Template[this.template].rendered = function() { + pkgRendered.call(this); + return userRendered.call(this); + }; + } else { + Template[this.template].rendered = pkgRendered; + } + + Template[this.template].events(AccountsEntry.entrySignUpEvents); + Template[this.template].helpers(AccountsEntry.entrySignUpHelpers); + + FlowLayout.render('entrySignUp'); + } + } +}); + +clearEntryError = function(context, redirect) { + Session.set('entryError', undefined); +}; + +FlowRouter.route('/forgot-password', { + name: 'entryForgotPassword', + triggersEnter: [clearEntryError], + action: function() { + FlowLayout.render('entryForgotPassword'); + } +}); + +FlowRouter.route('/sign-out', { + name: 'entrySignOut', + triggersEnter: [ + function(context, redirect) { + Session.set('entryError', undefined); + if (AccountsEntry.settings.homeRoute) { + Meteor.logout(function() { + return FlowRouter.go(AccountsEntry.settings.homeRoute); + }); + } + } + ], + action: function() { + FlowLayout.render('entrySignOut'); + } +}); + +FlowRouter.route('/verification-pending', { + name: 'entryVerificationPending', + triggersEnter: [clearEntryError], + action: function() { + FlowLayout.render('entryVerificationPending'); + } +}); + +FlowRouter.route('/reset-password/:resetToken', { + name: 'entryResetPassword', + triggersEnter: [ + function(context, redirect) { + Session.set('entryError', undefined); + Session.set('resetToken', this.params.resetToken); + } + ], + action: function() { + FlowLayout.render('entryResetPassword'); + } +}); + +FlowRouter.route('/enroll-account/:resetToken', { + name: 'entryEnrollAccount', + triggersEnter: [ + function(context, redirect) { + Session.set('entryError', undefined); + Session.set('resetToken', this.params.resetToken); + } + ], + action: function() { + FlowLayout.render('entryEnrollAccount'); + } +}); + +// set the fromWhere when you leave any path except the en +FlowRouter.triggers.exit([ + function(context) { + Session.set('fromWhere', context.path); + } + ], + { + except: [ + 'entrySignIn', + 'entrySignUp', + 'entryForgotPassword', + 'entrySignOut', + 'entryVerificationPending', + 'entryResetPassword', + 'entryEnrollAccount' + ] + } +); diff --git a/tests/client.coffee b/tests/client.coffee deleted file mode 100644 index ac5d78ff..00000000 --- a/tests/client.coffee +++ /dev/null @@ -1,50 +0,0 @@ -renderToDiv = (comp) -> - div = document.createElement("DIV") - Blaze.render(comp,div) - div - -Tinytest.add "Accounts Entry - {{accountButtons}} helper", (test) -> - div = renderToDiv(Template.test_helper_account_buttons) - html = canonicalizeHtml(div.innerHTML) - test.include html, "Sign In" - test.include html, "Register" - -Tinytest.add "Accounts Entry - wrapLinks setting on should wrap links in li elements", (test) -> - AccountsEntry.settings.wrapLinks = true - div = renderToDiv(Template.test_helper_account_buttons) - html = canonicalizeHtml(div.innerHTML) - test.include html, '
  • Sign In
  • ' - -Tinytest.add "Accounts Entry - wrapLinks setting on should not show 'or span'", (test) -> - AccountsEntry.settings.wrapLinks = true - div = renderToDiv(Template.test_helper_account_buttons) - html = canonicalizeHtml(div.innerHTML) - scan = html.indexOf('or') - test.equal(scan, -1, "Html output includes or span but shouldn't") - -Tinytest.add "Accounts Entry - wrapLinks setting off should not wrap links in li elements", (test) -> - AccountsEntry.settings.wrapLinks = false - div = renderToDiv(Template.test_helper_account_buttons) - html = canonicalizeHtml(div.innerHTML) - scan = html.indexOf('
  • ') - test.equal(scan, -1, "Html output shouldn't have li tags") - -Tinytest.add "Accounts Entry - wrapLinks setting off should show 'or span'", (test) -> - AccountsEntry.settings.wrapLinks = false - div = renderToDiv(Template.test_helper_account_buttons) - html = canonicalizeHtml(div.innerHTML) - test.include html, 'or' - -Tinytest.add "Accounts Entry - forgot password link should not show up if username only is set", (test) -> - AccountsEntry.settings.passwordSignupFields = "USERNAME_ONLY" - div = renderToDiv(Template.test_helper_sign_in) - html = canonicalizeHtml(div.innerHTML) - scan = html.indexOf('') - test.equal(scan, -1, "Forgot password link should not show up if username only is set") - -Tinytest.add "Accounts Entry - adding extra fields to the layout", (test) -> - AccountsEntry.settings.extraSignUpFields = [{field: 'zipcode', required: true, type: 'number'}] - Package['accounts-password'] = true - div = renderToDiv(Template.test_helper_sign_up) - html = canonicalizeHtml(div.innerHTML) - test.include html, '
    ' diff --git a/tests/client.html b/tests/client.html deleted file mode 100644 index 1ba0c8d1..00000000 --- a/tests/client.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/tests/route.coffee b/tests/route.coffee deleted file mode 100644 index 99f496d2..00000000 --- a/tests/route.coffee +++ /dev/null @@ -1,3 +0,0 @@ -Router.map -> - @route 'test_helper_home', - path: '/' diff --git a/tests/server.coffee b/tests/server.coffee deleted file mode 100644 index f22b1213..00000000 --- a/tests/server.coffee +++ /dev/null @@ -1 +0,0 @@ -# Put something here From 3c59fa752958f6c10b3b5df9a1a1d3f125dcecac Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Tue, 30 Jun 2015 22:31:58 -0400 Subject: [PATCH 2/9] removed tests --- package.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/package.js b/package.js index 7043b0cd..daab5fb1 100644 --- a/package.js +++ b/package.js @@ -85,18 +85,3 @@ Package.onUse(function(api) { api.addFiles(['shared/router.js'], ['client', 'server']); }); - -Package.onTest(function (api) { - api.use(['tinytest', - 'underscore', - 'handlebars', - 'test-helpers', - 'templating', - 'mongo-livedata', - 'coffeescript' - ]); - api.use(['meteorhacks:flow-router', 'softwarerero:accounts-t9n', 'joshowens:simple-form'], ['client', 'server']); - api.use('joshowens:accounts-entry'); - - api.addFiles(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client'); -}); From 94a9ea8916de397e4db5e25bc37591bdc4e293c8 Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Tue, 30 Jun 2015 22:34:31 -0400 Subject: [PATCH 3/9] set version on flow router --- .versions | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.js | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .versions diff --git a/.versions b/.versions new file mode 100644 index 00000000..2cb2a64a --- /dev/null +++ b/.versions @@ -0,0 +1,56 @@ +accounts-base@1.2.0 +accounts-password@1.1.1 +base64@1.0.3 +binary-heap@1.0.3 +blaze@2.1.2 +blaze-tools@1.0.3 +boilerplate-generator@1.0.3 +callback-hook@1.0.3 +check@1.0.5 +coffeescript@1.0.6 +cosmos:browserify@0.3.0 +ddp@1.1.0 +deps@1.0.7 +dovrosenberg:accounts-entry-flow@0.9.0 +ejson@1.0.6 +email@1.0.6 +geojson-utils@1.0.3 +handlebars@1.0.3 +html-tools@1.0.4 +htmljs@1.0.4 +id-map@1.0.3 +joshowens:simple-form@0.2.2 +jquery@1.11.3_2 +json@1.0.3 +less@1.0.14 +localstorage@1.0.3 +logging@1.0.7 +meteor@1.1.6 +meteorhacks:flow-router@1.17.1 +minifiers@1.1.5 +minimongo@1.0.8 +mongo@1.1.0 +mrt:underscore-string-latest@2.3.3 +npm-bcrypt@0.7.8_2 +observe-sequence@1.0.6 +ordered-dict@1.0.3 +random@1.0.3 +reactive-dict@1.1.0 +reactive-var@1.0.5 +retry@1.0.3 +routepolicy@1.0.5 +sacha:spin@2.0.4 +schnie:uploader@2.0.3 +service-configuration@1.0.4 +session@1.1.0 +sha@1.0.3 +softwarerero:accounts-t9n@1.0.9 +spacebars@1.0.6 +spacebars-compiler@1.0.6 +srp@1.0.3 +templating@1.1.1 +tracker@1.0.7 +ui@1.0.6 +underscore@1.0.3 +webapp@1.2.0 +webapp-hashing@1.0.3 diff --git a/package.js b/package.js index daab5fb1..2b5a5ccf 100644 --- a/package.js +++ b/package.js @@ -9,7 +9,7 @@ Package.describe({ Package.onUse(function(api) { api.versionsFrom("METEOR@0.9.0"); - api.use(['meteorhacks:flow-router', 'softwarerero:accounts-t9n@1.0.3', 'joshowens:simple-form@0.2.2', 'sacha:spin@2.0.4'], ['client', 'server']); + api.use(['meteorhacks:flow-router@1.17.1', 'softwarerero:accounts-t9n@1.0.3', 'joshowens:simple-form@0.2.2', 'sacha:spin@2.0.4'], ['client', 'server']); // CLIENT api.use([ 'deps', From e1b5158ea94a2b3dfbc54aabd6f4ea818ee57e8d Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Wed, 1 Jul 2015 09:23:27 -0400 Subject: [PATCH 4/9] fixed bug where entry routes were being hit by global trigger --- README.md | 5 +++++ client/entry.coffee | 10 +++++----- package.js | 2 +- shared/router.js | 22 +++++++++++----------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ecf115f8..73b54872 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,8 @@ FlowRouter.route('/dashboard', { } ); ```` + +You can also apply this to every route at once (making sure to exclude the logged out route): +````js +FlowRouter.triggers.enter([AccountsEntrySignInRequired], {except: ['loggedOut']}); +```` diff --git a/client/entry.coffee b/client/entry.coffee index 0044c9b3..7a327558 100644 --- a/client/entry.coffee +++ b/client/entry.coffee @@ -34,11 +34,11 @@ AccountsEntry = @AccountsEntry = AccountsEntry AccountsEntrySignInRequired = (context, redirect) -> - unless Meteor.loggingIn() - unless Meteor.user() - Session.set('fromWhere', context.path) - redirect('/sign-in') - Session.set('entryError', t9n('error.signInRequired')) + if !_.contains(AccountsEntryRouteList, context.route.name) and + !Meteor.loggingIn() and !Meteor.user() + Session.set 'fromWhere', context.path + redirect '/sign-in' + Session.set('entryError', t9n('error.signInRequired')) class @T9NHelper diff --git a/package.js b/package.js index 2b5a5ccf..8b2770f2 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "dovrosenberg:accounts-entry-flow", - version: '0.9.0', + version: '0.9.1', summary: "Make signin and signout their own pages with routes.", git: 'https://github.com/dovrosenberg/accounts-entry', documentation: 'README.md' diff --git a/shared/router.js b/shared/router.js index 92b47832..b667c09c 100644 --- a/shared/router.js +++ b/shared/router.js @@ -131,21 +131,21 @@ FlowRouter.route('/enroll-account/:resetToken', { } }); +AccountsEntryRouteList = [ + 'entrySignIn', + 'entrySignUp', + 'entryForgotPassword', + 'entrySignOut', + 'entryVerificationPending', + 'entryResetPassword', + 'entryEnrollAccount' +]; + // set the fromWhere when you leave any path except the en FlowRouter.triggers.exit([ function(context) { Session.set('fromWhere', context.path); } ], - { - except: [ - 'entrySignIn', - 'entrySignUp', - 'entryForgotPassword', - 'entrySignOut', - 'entryVerificationPending', - 'entryResetPassword', - 'entryEnrollAccount' - ] - } + { except: AccountsEntryRouteList } ); From cb13d04a74f7e9efdd0b021a79aaa438dd3dc08a Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Wed, 1 Jul 2015 09:46:16 -0400 Subject: [PATCH 5/9] updated versions file --- .versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.versions b/.versions index 2cb2a64a..8d258b06 100644 --- a/.versions +++ b/.versions @@ -11,7 +11,7 @@ coffeescript@1.0.6 cosmos:browserify@0.3.0 ddp@1.1.0 deps@1.0.7 -dovrosenberg:accounts-entry-flow@0.9.0 +dovrosenberg:accounts-entry-flow@0.9.1 ejson@1.0.6 email@1.0.6 geojson-utils@1.0.3 From ed1b5cee1ca31e4c964499b89d0925ef562a8414 Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Sat, 4 Jul 2015 18:09:27 -0400 Subject: [PATCH 6/9] Fixed bug in signUp form --- package.js | 2 +- shared/router.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.js b/package.js index 8b2770f2..44b10b72 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "dovrosenberg:accounts-entry-flow", - version: '0.9.1', + version: '0.9.2', summary: "Make signin and signout their own pages with routes.", git: 'https://github.com/dovrosenberg/accounts-entry', documentation: 'README.md' diff --git a/shared/router.js b/shared/router.js index b667c09c..21809f06 100644 --- a/shared/router.js +++ b/shared/router.js @@ -62,9 +62,8 @@ FlowRouter.route('/sign-up', { Template[this.template].events(AccountsEntry.entrySignUpEvents); Template[this.template].helpers(AccountsEntry.entrySignUpHelpers); - - FlowLayout.render('entrySignUp'); } + FlowLayout.render('entrySignUp'); } }); From 6967afc999237d5bbafb9f055da05716d8f1700a Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Wed, 8 Jul 2015 19:14:10 -0400 Subject: [PATCH 7/9] Fixed bug in signupcode searching array --- .versions | 2 +- package.js | 2 +- server/entry.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.versions b/.versions index 8d258b06..0a414d4a 100644 --- a/.versions +++ b/.versions @@ -11,7 +11,7 @@ coffeescript@1.0.6 cosmos:browserify@0.3.0 ddp@1.1.0 deps@1.0.7 -dovrosenberg:accounts-entry-flow@0.9.1 +dovrosenberg:accounts-entry-flow@0.9.2 ejson@1.0.6 email@1.0.6 geojson-utils@1.0.3 diff --git a/package.js b/package.js index 44b10b72..5bb143ee 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "dovrosenberg:accounts-entry-flow", - version: '0.9.2', + version: '0.9.3', summary: "Make signin and signout their own pages with routes.", git: 'https://github.com/dovrosenberg/accounts-entry', documentation: 'README.md' diff --git a/server/entry.coffee b/server/entry.coffee index 4062718f..f7b84019 100644 --- a/server/entry.coffee +++ b/server/entry.coffee @@ -16,7 +16,7 @@ Meteor.startup -> Meteor.methods entryValidateSignupCode: (signupCode) -> check signupCode, Match.OneOf(String, null, undefined) - not AccountsEntry.settings.signupCode or signupCode is AccountsEntry.settings.signupCode + not AccountsEntry.settings.signupCode or signupCode in AccountsEntry.settings.signupCode entryCreateUser: (user) -> check user, Object From 1ea415ed3ec4cc7dd8c1135e874bd79a296705db Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Wed, 8 Jul 2015 21:08:06 -0400 Subject: [PATCH 8/9] Fixed another bug with array of signupCodes --- .versions | 2 +- README.md | 14 -------------- package.js | 2 +- server/entry.coffee | 2 +- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/.versions b/.versions index 0a414d4a..a9950946 100644 --- a/.versions +++ b/.versions @@ -11,7 +11,7 @@ coffeescript@1.0.6 cosmos:browserify@0.3.0 ddp@1.1.0 deps@1.0.7 -dovrosenberg:accounts-entry-flow@0.9.2 +dovrosenberg:accounts-entry-flow@0.9.4 ejson@1.0.6 email@1.0.6 geojson-utils@1.0.3 diff --git a/README.md b/README.md index 73b54872..db16d999 100644 --- a/README.md +++ b/README.md @@ -10,20 +10,6 @@ meteor add dovrosenberg:accounts-entry-flow See the [original](https://github.com/Differential/accounts-entry) package for more details on usage and examples. The differences are described here: -## 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 Use the helper function AccountsEntrySignInRequired in an entry trigger for any route that requires users to be signed in. This will 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. diff --git a/package.js b/package.js index 5bb143ee..97fd6ff3 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "dovrosenberg:accounts-entry-flow", - version: '0.9.3', + version: '0.9.4', summary: "Make signin and signout their own pages with routes.", git: 'https://github.com/dovrosenberg/accounts-entry', documentation: 'README.md' diff --git a/server/entry.coffee b/server/entry.coffee index f7b84019..03424e5d 100644 --- a/server/entry.coffee +++ b/server/entry.coffee @@ -16,7 +16,7 @@ Meteor.startup -> Meteor.methods entryValidateSignupCode: (signupCode) -> check signupCode, Match.OneOf(String, null, undefined) - not AccountsEntry.settings.signupCode or signupCode in AccountsEntry.settings.signupCode + not AccountsEntry.settings.signupCode or _.contains(AccountsEntry.settings.signupCode, signupCode) entryCreateUser: (user) -> check user, Object From 00ee30f64085761476233021a65a3ccf330e36fa Mon Sep 17 00:00:00 2001 From: dovrosenberg Date: Thu, 30 Jul 2015 21:03:55 -0400 Subject: [PATCH 9/9] Updated to flow router 2.0 --- .versions | 6 +++--- package.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.versions b/.versions index a9950946..eaaaa91d 100644 --- a/.versions +++ b/.versions @@ -8,10 +8,10 @@ boilerplate-generator@1.0.3 callback-hook@1.0.3 check@1.0.5 coffeescript@1.0.6 -cosmos:browserify@0.3.0 +cosmos:browserify@0.5.0 ddp@1.1.0 deps@1.0.7 -dovrosenberg:accounts-entry-flow@0.9.4 +dovrosenberg:accounts-entry-flow@0.9.5 ejson@1.0.6 email@1.0.6 geojson-utils@1.0.3 @@ -22,11 +22,11 @@ id-map@1.0.3 joshowens:simple-form@0.2.2 jquery@1.11.3_2 json@1.0.3 +kadira:flow-router@2.0.0 less@1.0.14 localstorage@1.0.3 logging@1.0.7 meteor@1.1.6 -meteorhacks:flow-router@1.17.1 minifiers@1.1.5 minimongo@1.0.8 mongo@1.1.0 diff --git a/package.js b/package.js index 97fd6ff3..5eadbfdd 100644 --- a/package.js +++ b/package.js @@ -1,15 +1,15 @@ Package.describe({ name: "dovrosenberg:accounts-entry-flow", - version: '0.9.4', + version: '0.9.5', summary: "Make signin and signout their own pages with routes.", git: 'https://github.com/dovrosenberg/accounts-entry', documentation: 'README.md' }); Package.onUse(function(api) { - api.versionsFrom("METEOR@0.9.0"); + api.versionsFrom("METEOR@1.1.0.2"); - api.use(['meteorhacks:flow-router@1.17.1', 'softwarerero:accounts-t9n@1.0.3', 'joshowens:simple-form@0.2.2', 'sacha:spin@2.0.4'], ['client', 'server']); + api.use(['kadira:flow-router@2.0.0', 'softwarerero:accounts-t9n@1.0.3', 'joshowens:simple-form@0.2.2', 'sacha:spin@2.0.4'], ['client', 'server']); // CLIENT api.use([ 'deps',