--- a/src/newseasons/models/users.clj Wed Sep 28 23:28:56 2011 -0400
+++ b/src/newseasons/models/users.clj Wed Sep 28 23:40:36 2011 -0400
@@ -23,9 +23,9 @@
(str "users:" email ":shows"))
(defn user-get [email]
- (let [user @(r [:hgetall (user-key email)])]
+ (let [user (apply hash-map @(r [:hgetall (user-key email)]))]
(when (not (empty? user))
- (merge user
+ (merge {:email (user "email") :pass (user "pass")}
{:shows @(r [:smembers (user-key-shows email)])}))))
(defn user-set-email! [email new-email]
--- a/src/newseasons/views/main.clj Wed Sep 28 23:28:56 2011 -0400
+++ b/src/newseasons/views/main.clj Wed Sep 28 23:40:36 2011 -0400
@@ -60,11 +60,14 @@
(flash! "That's not an email address!")
(if-let [user (users/user-get email)]
(if (crypt/compare password (:pass user))
- user
+ (do
+ (sess/put! :email email)
+ user)
(flash! "Invalid login!"))
(do
(users/user-set-email! email email)
(users/user-set-pass! email password)
+ (sess/put! :email email)
(users/user-get email))))))
@@ -83,7 +86,7 @@
; User ------------------------------------------------------------------------
(defpage [:get ["/:email" :email email-regex]] {:keys [email]}
(login-required
- (if (not= email (sess/get email))
+ (if (not= email (sess/get :email))
(force-login)
(t/user email))))