             data (get user id)]
         (assoc field :data data)))))
 
+(defn update-loggedin-user [data] (update-user (get-logged-in-username) data))
+
+(defn is-logged-in [] (friend/anonymous?))
+
+
 (def friend-settings
   {:credential-fn             (partial creds/bcrypt-credential-fn login-user)
    :workflows                 [(workflows/interactive-form)]

  (if (is-user-activated username)
    (do
      (let [db-id (get-entity-from-double-vec (find-by-column-and-search-string username-kw username))]
        {:username username :roles (get-roles db-id) :password (pw-kw db-id)}
      ))
    )
  )

(defn update-user [username data]
  @(d/transact (conn-datomic) [(merge {:db/id [:user/email username]} data)]))

      (merge user (into {} [[:password (pw-kw db-id)]]))
      user)))

(defn get-user-db-entity
  ([] (get-user-db-entity (get-logged-in-username)))
  ([username]
   (get-entity-from-double-vec (find-by-column-and-search-string username-kw username))))

(defn set-user-activated [username] @(d/transact (conn-datomic) [{:db/id [username-kw username], activated-kw true}]))

(defn account-activated [activationid]
  (let [id (find-by-column-and-search-string activated-kw activationid)]
