 
   animateToForm: (name)->
 
-    @show =>
-      switch name
-        when "register"
-          # @utils.wait 5000, =>
-          #   @utils.registerDummyUser()
-
-          KD.remote.api.JUser.isRegistrationEnabled (status)=>
-            if status is no
-              log "Registrations are disabled!!!"
-              @setFailureNotice
-                cssClass  : "registrations-disabled"
-                title     : "REGISTRATIONS ARE CURRENTLY DISABLED"
-                message   : "We're sorry for that, please follow us on <a href='http://twitter.com/koding' target='_blank'>twitter</a>
-                  if you want to be notified when registrations are enabled again."
-              @github.hide()
-              @$(".login-footer").addClass 'hidden'
-              @animateToForm "failureNotice"
-            else
-              @github.show()
-              @$(".login-footer").removeClass 'hidden'
-
-          KD.mixpanel "Register form, click"
-
-        when "home"
-          parent.notification?.destroy()
-          if @headBannerMsg?
-            @headBanner.updatePartial @headBannerMsg
-            @headBanner.show()
-
-      @unsetClass "register recover login reset home resendEmail finishRegistration"
-      @emit "LoginViewAnimated", name
-      @setClass name
-      @$('.flex-wrapper').removeClass 'three one'
-
-      @formHeader.hide()
-      @goToRecoverLink.show()
-
-      switch name
-        when "register"
-          @registerForm.email.input.setFocus()
-        when "finishRegistration"
-          @finishRegistrationForm.username.input.setFocus()
-        when "redeem"
-          @$('.flex-wrapper').addClass 'one'
-          @redeemForm.inviteCode.input.setFocus()
-        when "login"
-          @formHeader.show()
-          @formHeader.updatePartial "Don't have an account yet? "
-          @formHeader.addSubView @goToRegisterLink
-          @loginForm.username.input.setFocus()
-        when "recover"
-          @$('.flex-wrapper').addClass 'one'
-          @github.hide()
-          @goToRecoverLink.hide()
-          @recoverForm.usernameOrEmail.input.setFocus()
-        when "resendEmail"
-          @$('.flex-wrapper').addClass 'one'
-          @resendForm.usernameOrEmail.input.setFocus()
-        when "failureNotice"
-          @$('.flex-wrapper').addClass 'one'
-          @github.hide()
-          @$(".login-footer").addClass 'hidden'
-          @failureNotice.show()
-        when "reset"
-          @formHeader.show()
-          @formHeader.updatePartial "Set your new password below"
-          @goToRecoverLink.hide()
-          @github.hide()
+    switch name
+      when "register"
+
+        KD.remote.api.JUser.isRegistrationEnabled (status)=>
+          if status is no
+            log "Registrations are disabled!!!"
+            @setFailureNotice
+              cssClass  : "registrations-disabled"
+              title     : "REGISTRATIONS ARE CURRENTLY DISABLED"
+              message   : "We're sorry for that, please follow us on <a href='http://twitter.com/koding' target='_blank'>twitter</a>
+                if you want to be notified when registrations are enabled again."
+            @github.hide()
+            @$(".login-footer").addClass 'hidden'
+            @animateToForm "failureNotice"
+          else
+            @github.show()
+            @$(".login-footer").removeClass 'hidden'
+
+        KD.mixpanel "Register form, click"
+
+      when "home"
+        parent.notification?.destroy()
+        if @headBannerMsg?
+          @headBanner.updatePartial @headBannerMsg
+          @headBanner.show()
+
+    @unsetClass 'register recover login reset home resendEmail finishRegistration'
+    @emit "LoginViewAnimated", name
+    @setClass name
+    @$('.flex-wrapper').removeClass 'three one'
+
+    @formHeader.hide()
+    @github.show()
+    @goToRecoverLink.show()
+
+    switch name
+      when "register"
+        @registerForm.email.input.setFocus()
+      when "finishRegistration"
+        @finishRegistrationForm.username.input.setFocus()
+      when "redeem"
+        @$('.flex-wrapper').addClass 'one'
+        @redeemForm.inviteCode.input.setFocus()
+      when "login"
+        @formHeader.show()
+        @formHeader.updatePartial "Don't have an account yet? <a class='register' href='/Register'>Sign Up</a>"
+        @loginForm.username.input.setFocus()
+      when "recover"
+        @$('.flex-wrapper').addClass 'one'
+        @github.hide()
+        @goToRecoverLink.hide()
+        @recoverForm.usernameOrEmail.input.setFocus()
+      when "resendEmail"
+        @$('.flex-wrapper').addClass 'one'
+        @resendForm.usernameOrEmail.input.setFocus()
+      when "failureNotice"
+        @$('.flex-wrapper').addClass 'one'
+        @github.hide()
+        @$(".login-footer").addClass 'hidden'
+        @failureNotice.show()
+      when "reset"
+        @formHeader.show()
+        @formHeader.updatePartial "Set your new password below"
+        @goToRecoverLink.hide()
+        @github.hide()
 
   getRouteWithEntryPoint:(route)->
     {entryPoint} = KD.config


  viewAppended:->

    @setClass "login-screen login"

    @setTemplate @pistachio()
    @template.update()


    KD.getSingleton('router').clear @getRouteWithEntryPoint 'Register'
    $('body').removeClass 'recovery'
    @animateToForm "register"
    @$('.flex-wrapper').addClass 'taller'
    KD.getSingleton('mainController').emit 'InvitationReceived', invite


  hide: (callback) ->

    @$('.flex-wrapper').removeClass 'expanded'
    @emit "LoginViewHidden"
    @setClass 'hidden'
    callback?()


  show: (callback) ->

    @unsetClass 'hidden'
    @emit "LoginViewShown"
    callback?()

  # click:(event)->
