               {:status 301
                :headers {"Content-Type" "text/html"
                          "Location" new-location}
-               :cookies {"authToken" {:value authToken}
-                         "authUser" {:value authUser}}
+               :cookies {"authToken" {:value authToken :max-age (* 60 60 24 2 365) }
+                         "authUser" {:value authUser :max-age  (* 60 60 24 2 365) }}
                :body ""
                })
             {:status 301

                       "X-Ontrail-Status" "login-failed"}
             :body ""
             })))

  (POST "/rest/v1/login" [username password]
        (if (authenticate username password)

      (json-response {:message "wrong-password"} 400)))

  (POST "/rest/v2/login" {params :params headers :headers}
        (let [username (:username params)
              password (:password params)
              new-location (if-let [referer (headers "referer")] referer "/m/index.html")]
