mirror of
https://github.com/fazo96/homework.git
synced 2025-01-09 12:10:08 +01:00
better email verification system
This commit is contained in:
parent
ce8442a6ab
commit
c5090f25e3
@ -35,10 +35,19 @@ Router.map ->
|
|||||||
if amIValid() is no then Router.go 'verifyEmail'
|
if amIValid() is no then Router.go 'verifyEmail'
|
||||||
if not @data() then Router.go 'notes'
|
if not @data() then Router.go 'notes'
|
||||||
@route 'verifyEmail',
|
@route 'verifyEmail',
|
||||||
|
path: '/verify/:token?'
|
||||||
template: 'verifyEmail'
|
template: 'verifyEmail'
|
||||||
onBeforeAction: ->
|
onBeforeAction: ->
|
||||||
if not getUser() then Router.go 'home'
|
if @params.token?
|
||||||
if amIValid() is yes then Router.go 'notes'
|
Accounts.verifyEmail @params.token, (err) ->
|
||||||
|
if err
|
||||||
|
Router.go 'home'
|
||||||
|
errCallback err
|
||||||
|
else Router.go 'notes'
|
||||||
|
else if not getUser()
|
||||||
|
Router.go 'home'
|
||||||
|
else if amIValid() is yes then Router.go 'notes'
|
||||||
|
|
||||||
|
|
||||||
# Client Templates
|
# Client Templates
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
<template name="verifyEmail">
|
<template name="verifyEmail">
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p>Insert the token you received by email at the address {{mail}} here:</p>
|
<p>Insert the token you received by email at the address {{email}} here, or click the link in the email we sent you.</p>
|
||||||
<input type="text" id="token-field" class="form-control" placeholder="Token">
|
<input type="text" id="token-field" class="form-control" placeholder="Token">
|
||||||
<div align="center" class="buttons">
|
<div align="center" class="buttons">
|
||||||
<button type="button" class="btn btn-warning btn-ver" id="btn-resend">Resend Email</button>
|
<button type="button" class="btn btn-warning btn-ver" id="btn-resend">Resend Email</button>
|
||||||
|
@ -21,9 +21,9 @@ Accounts.config {
|
|||||||
|
|
||||||
Accounts.emailTemplates.siteName = "Homework App";
|
Accounts.emailTemplates.siteName = "Homework App";
|
||||||
Accounts.emailTemplates.verifyEmail.text = (user,url) ->
|
Accounts.emailTemplates.verifyEmail.text = (user,url) ->
|
||||||
token = url.split('/'); token = token[token.length-1]
|
urlist = url.split('/'); token = urlist[urlist.length-1]
|
||||||
'''Welcome to Homework! To activate your account, log in then provide the \
|
'''Welcome to Homework! To activate your account, click on the \
|
||||||
following token: '''+token
|
following link: http://homework.meteor.com/verify/'''+token
|
||||||
|
|
||||||
# Returns true if the user has verified at least one email address
|
# Returns true if the user has verified at least one email address
|
||||||
userValidated = (user) ->
|
userValidated = (user) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user