summaryrefslogtreecommitdiff
path: root/src/utils.clj
diff options
context:
space:
mode:
authortim b <timb@camcompu.home>2010-07-03 17:20:54 -0700
committertim b <timb@camcompu.home>2010-07-03 17:20:54 -0700
commitef58e04d1dbf1084cbae5a803dce683f555beddb (patch)
treec465f0f1ba3ae67a9111795c9159f1a3ff0e4705 /src/utils.clj
parent8db58a14273076b4b728ce130c8854289c32064e (diff)
add last_login time and last_ip to users table
Diffstat (limited to 'src/utils.clj')
-rwxr-xr-xsrc/utils.clj5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils.clj b/src/utils.clj
index 9008793..607343e 100755
--- a/src/utils.clj
+++ b/src/utils.clj
@@ -40,6 +40,11 @@
(slurp* url)
(throw (Exception. (str "Invalid url " u))))))
+(defn get-ip [request]
+ (let [ip (get (:headers request) "x-real-ip") ; behind nginx
+ ip (if ip ip (:remote-addr request))] (str ip)) ; deployed locally
+)
+
(defn append [& vecs]
(reduce into vecs))