From 6acf267a047f69d202590cc7166c3d17bc9d6e53 Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 2 Dec 2015 17:38:28 +0100 Subject: [PATCH] try to add a check for first_log_in but according to rkh it's possibly in the wrong place. What if there's no user?? --- lib/travis/api/app/endpoint/authorization.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/travis/api/app/endpoint/authorization.rb b/lib/travis/api/app/endpoint/authorization.rb index 41b06e75..456ac0e8 100644 --- a/lib/travis/api/app/endpoint/authorization.rb +++ b/lib/travis/api/app/endpoint/authorization.rb @@ -194,6 +194,7 @@ class Travis::Api::App end end + def create_state state = SecureRandom.urlsafe_base64(16) redis.sadd('github:states', state) @@ -223,6 +224,16 @@ class Travis::Api::App super @user = ::User.find_by_github_id(data['id']) + check_first_login(@user) + # where is a user created if there is no user yet on our sytem + + end + + def check_first_login(user) + return if user.first_logged_in_at + puts "this is the first log in!!" + # user.update_attributes(first_logged_in_at: Time.now) + # #send event to customer.io end def info(attributes = {})