Skip to content

Commit

Permalink
Merge pull request #100 from softwarerero/master
Browse files Browse the repository at this point in the history
use session varable "fromWhere" for routing whenever it is set
  • Loading branch information
queso committed Feb 28, 2014
2 parents 7c7f51a + ac9a812 commit 198dda2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
1 change: 0 additions & 1 deletion client/entry.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ AccountsEntry =
class @T9NHelper

@translate: (code) ->
# console.log "translate: #{code}"
T9n.get code, "error.accounts"

@accountsError: (err) ->
Expand Down
36 changes: 14 additions & 22 deletions client/views/signUp/signUp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ Template.entrySignUp.events
return


Meteor.call('entryValidateSignupCode', signupCode, (err, valid) ->
if err
console.log err
Meteor.call 'entryValidateSignupCode', signupCode, (err, valid) ->
if valid
newUserData =
username: username
Expand All @@ -123,27 +121,21 @@ Template.entrySignUp.events
T9NHelper.accountsError err
return
#login on client
if _.contains([
isEmailSignUp = _.contains([
'USERNAME_AND_EMAIL',
'EMAIL_ONLY'], AccountsEntry.settings.passwordSignupFields)
Meteor.loginWithPassword(email, password, (error) ->
if error
T9NHelper.accountsError error
else
Router.go AccountsEntry.settings.dashboardRoute
)
else
Meteor.loginWithPassword(username, password, (error) ->
if error
T9NHelper.accountsError error
else if Session.get('fromWhere')
Router.go Session.get('fromWhere')
Session.set('fromWhere', undefined)
else
Router.go AccountsEntry.settings.dashboardRoute
)
userCredential = if isEmailSignUp then email else username
Meteor.loginWithPassword userCredential, password, (error) ->
if error
T9NHelper.accountsError error
else if Session.get 'fromWhere'
Router.go Session.get('fromWhere')
Session.set 'fromWhere', undefined
else
Router.go AccountsEntry.settings.dashboardRoute
else
Session.set('entryError', i18n("error.signupCodeIncorrect"))
console.log err
Session.set 'entryError', i18n("error.signupCodeIncorrect")
return
)


0 comments on commit 198dda2

Please sign in to comment.