 (defpage "/details" []
          (ppl_auth/github-user-email (session/get :github-token)))
 
-(defpage "/profile" [])
+(defpage "/profile" []
+  (when-not (ppl_auth/logged-in?)
+    (redirect "/login")))

  (seq (select users (fields :id)(where {:email email}))))

(defn update-token [id token]
  (if-not (seq (select users (fields :id)(where {:email email :access_token token})))
    (update users (set-fields {:access_token token})(where {:id id}))
    )
  (id)

  (:require [clj-oauth2.client :as oauth2])
  (:require [ppl.auth :as ppl_auth])
  ;(:require [korma.db :refer [select]])
  (:use [korma.core :only [select where fields, insert, values, update, set-fields]])
  ;(:require [ppl.models :refer [users]])
  (:use [ppl.models :only [users]])
  ;(:require [korma.db] 
