      (if (ok? context)
        (let [usernames (get-in context [:request :session :usernames])
              new-user (get-in context [:response :body :username])]
-         (assoc-in context [:response :session] (extend {:usernames (conj usernames new-user)})))
+         (assoc-in context [:response :session] (extend-session {:usernames (conj usernames new-user)})))
        context))})
 
 (defn logins [handler] [(body-params/body-params)

   (fn [context]
     (if (ok? context)
       (let [session (or (get-in context [:request :session]) {})]
         (assoc-in context [:response :session] (extend session)))
       context))})

(def add-user-to-session

  [usernames expiration]
  (and (not (empty? usernames)) (java-time/before? expiration (java-time/instant))))

(defn- extend-session
  [session]
  (log/info :msg session)
  (assoc session :expiration (java-time/plus (java-time/instant) (java-time/seconds (Integer/parseInt (:subticket-session-length-in-seconds env))))))
