<commit_before>(ns ohds.login
  (:require [petrol.core :refer [wrap Message EventSource]]
            [cljs-http.client :as http]))

(defrecord LoginResult [body])

(defrecord SubmitLogin []
  Message
  (process-message [msg app]
    (if (= (:username (:login app))
           "good-username")
      (assoc app :page :hierarchy-select)
      app))
  EventSource
  (watch-channels [msg app]
    (println "watch-channels about to wrap")
    #{(wrap
       map->LoginResult
       (http/post "/api/v1/login"
                  {:form-params (:login app)}))}))
<commit_msg>copy login to compressed module<commit_after>(ns ohds.login
  (:require [petrol.core :refer [wrap Message EventSource]]
            [cljs-http.client :as http]
            [ohds.login.messages :as m]
            [ohds.components :as c]
            [ohds.model :refer [valid-login?]]))

(defrecord LoginResult [body])

(defrecord SubmitLogin []
  Message
  (process-message [msg app]
    (if (= (:username (:login app))
           "good-username")
      (assoc app :page :hierarchy-select)
      app))
  EventSource
  (watch-channels [msg app]
    (println "watch-channels about to wrap")
    #{(wrap
       map->LoginResult
       (http/post "/api/v1/login"
                  {:form-params (:login app)}))}))


(defn login [ch state]
  [:span
   [:legend "Login"]
   (c/text-input ch m/->ChangeUsername "username" "Username" state)
   (c/password-input ch m/->ChangePassword "password" "Password")
   (c/checkbox "administrator" "Administrator" ch (m/->ToggleAdmin))

   (when (valid-login? state)
     (c/submit ch m/->FieldworkerLogin "Login"))])

{'fraction_non_alphanumeric': 0.15151515151515152, 'fraction_numerical': 0.0012368583797155227, 'mean_word_length': 2.7367205542725173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3274467', 'n_tokens_mistral': 531, 'n_tokens_neox': 514, 'n_words': 135}