Small code cleanup.

This commit is contained in:
Martin Edenhofer 2014-10-05 20:33:43 +02:00
parent d8cec02fd8
commit 7a2e2cd1d2

View file

@ -39,7 +39,7 @@ class Index extends App.ControllerContent
)
render: ->
console.log('RENDER 1')
# check authentication, redirect to login if master user already exists
if !@master_user && !@authenticate()
@navigate '#login'
@ -51,13 +51,13 @@ class Index extends App.ControllerContent
new App.ControllerForm(
el: @el.find('#form-master')
model: App.User
required: 'signup'
screen: 'signup'
autofocus: true
)
new App.ControllerForm(
el: @el.find('#form-agent')
model: App.User
required: 'invite_agent'
screen: 'invite_agent'
autofocus: true
)
@ -94,8 +94,7 @@ class Index extends App.ControllerContent
# save user
user.save(
done: (r) =>
done: =>
if @master_user
@master_user = false
App.Auth.login(
@ -106,7 +105,7 @@ class Index extends App.ControllerContent
success: @relogin
# error: @error,
)
@Config.set('system_init_done', true)
App.Event.trigger 'notify', {
type: 'success'
msg: App.i18n.translateContent( 'Welcome to %s!', @Config.get('product_name') )
@ -123,8 +122,8 @@ class Index extends App.ControllerContent
# rerender page
@render()
fail: (data) ->
fail: (data) ->
App.Event.trigger 'notify', {
type: 'error'
msg: App.i18n.translateContent( 'Can\'t create user!' )