Differential/accounts-entry — pull request #296 by gerwinbrunner (2014-10-02 22:56:39+00:00)
Title: Force new users to confirm email before allowing them to log in 

This PR will enable guest on the website to register for new user accounts and have them redirected to a "check your email" page (instead of directly logged in).
Only after they confirmed the email address by clicking on the link sent via email they are able to log in.

I hope this is in a condition for you to use. If you need anything else, please let me know.

Best,
Gerwin

I assume that mail sending is set up correctly.

Settings on the client:
```
Meteor.startup ->
AccountsEntry.config
verifyEmail: true
verifyEmailRoute: '/checkemail'
```

Setting you need to set on the server only:
```
Meteor.startup ->
console.log "Server started"

Accounts.config
sendVerificationEmail: true

Accounts.urls.verifyEmail = (token) ->
Meteor.absoluteUrl "verify-email/" + token

# Make sure only users with validated emails can log in
Accounts.validateLoginAttempt (attempt) ->
if attempt.user and attempt.user.emails and not attempt.user.emails[0].verified
console.log "email not verified"
return false # the login is aborted
true

```

Routes you may need:
(Be aware that you have to also create the templates (not shown here).
```
Router.map ->

# SignUp emails
@route "verifyEmail",
controller: "AccountController"
path: "/verify-email/:token"
action: "verifyEmail"

@route "verified",
path: "/verified"
template: "verified"

@route "checkemail",
path: "/checkemail"
template: "checkemail"
```