Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customization to reset & forgot password templates added #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions shared/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,27 @@ Router.map ->
onBeforeAction: ->
Session.set('entryError', undefined)
@next()
onRun: ->
if AccountsEntry.settings.forgotPasswordTemplate
@template = AccountsEntry.settings.forgotPasswordTemplate

# 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.entryForgotPassword.rendered
userRendered = Template[@template].rendered

if userRendered
Template[@template].rendered = ->
pkgRendered.call(@)
userRendered.call(@)
else
Template[@template].rendered = pkgRendered

Template[@template].events(AccountsEntry.entryForgotPasswordEvents)
Template[@template].helpers(AccountsEntry.entryForgotPasswordHelpers)
@next()

@route 'entrySignOut',
path: '/sign-out'
onBeforeAction: ()->
Expand All @@ -80,6 +100,26 @@ Router.map ->
Session.set('entryError', undefined)
Session.set('resetToken', @params.resetToken)
@next()
onRun: ->
if AccountsEntry.settings.resetPasswordTemplate
@template = AccountsEntry.settings.resetPasswordTemplate

# 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.entryResetPassword.rendered
userRendered = Template[@template].rendered

if userRendered
Template[@template].rendered = ->
pkgRendered.call(@)
userRendered.call(@)
else
Template[@template].rendered = pkgRendered

Template[@template].events(AccountsEntry.entryResetPasswordEvents)
Template[@template].helpers(AccountsEntry.entryResetPasswordHelpers)
@next()

# Get all the accounts-entry routes one time
exclusions = []
Expand Down