       @set "simwmsUserSession", null
       @set "state", "login-failed"
     .finally => @
-  cookieLogin: ->
+  cookieLogin: (userToken) ->
+    if Ember.isPresent userToken
+      @set "simwmsUserSession", userToken 
     @store.find "session", "cookie-session"
     .then (session) =>
       @set "session", session

      @set "simwmsUserSession", null
      @set "state", "login-failed"
    .finally => @
  smartLogin: ({email, accountToken, password}) ->
    @login({email, password})
    .then (session) =>
      if accountToken?
        @accountLogin accountToken
      else
        session
    .finally => @
  accountLogout: ->
    @set "simwmsAccountSession", null

  rank: alias "employee.role"
  isLoggedIn: equal "state", "login-success"
  accountLoggedIn: ifPresent "account.permalink"
  username: alias "session.username"
  namespace: alias "account.namespace"
  permalink: alias "account.permalink"
  host: alias "account.host"
