Fixed getting started, only relogin first/master agent.

This commit is contained in:
Martin Edenhofer 2012-04-13 16:13:00 +02:00
parent a6d67d851c
commit c7baf0b6ab

View file

@ -4,7 +4,7 @@ class Index extends App.Controller
className: 'container getstarted' className: 'container getstarted'
events: events:
'submit form': 'submit', 'submit form': 'submit',
'click .submit': 'submit', 'click .submit': 'submit',
constructor: -> constructor: ->
@ -87,43 +87,45 @@ class Index extends App.Controller
# save user # save user
user.save( user.save(
success: (r) => success: (r) =>
# send email
# clear form if @master_user
auth = new App.Auth @master_user = false
auth.login( auth = new App.Auth
data: { auth.login(
username: @params.login, data: {
password: @params.password, username: @params.login,
}, password: @params.password,
success: @success },
# error: @error, success: @relogin
) # error: @error,
)
else
# rerender page
@render()
# error: => # error: =>
# @modalHide() # @modalHide()
) )
success: (data, status, xhr) => relogin: (data, status, xhr) =>
@log 'login:success', data @log 'login:success', data
if @master_user # login check
auth = new App.Auth
auth.loginCheck()
# login check # add notify
auth = new App.Auth Spine.trigger 'notify:removeall'
auth.loginCheck()
# add notify
Spine.trigger 'notify:removeall'
# @notify # @notify
# type: 'success', # type: 'success',
# msg: 'Thanks for joining. Email sent to "' + @params.email + '". Please verify your email address.' # msg: 'Thanks for joining. Email sent to "' + @params.email + '". Please verify your email address.'
@el.find('.master_user').fadeOut('slow', => @el.find('.master_user').fadeOut('slow', =>
@el.find('.agent_user').fadeIn() @el.find('.agent_user').fadeIn()
) )
# redirect to #
# @navigate '#getting_started'
# @fetch()
Config.Routes['getting_started'] = Index Config.Routes['getting_started'] = Index