From 5aaa389a4bffdcf32f8b1b1ff06aea176c254888 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 21 Mar 2014 22:37:15 +0000 Subject: [PATCH] * VRFS-1386 - check if invited_user.email is nil, and change existing test to have email --- ruby/lib/jam_ruby/models/user.rb | 2 +- web/app/controllers/users_controller.rb | 4 ++-- web/spec/features/signup_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 4af4515d3..6b83dc815 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -780,7 +780,7 @@ module JamRuby # if you came in from an invite and used the same email to signup, # then we know you are a real human and that your email is valid. # lucky! we'll log you in immediately - if invited_user.email.casecmp(user.email).zero? + if invited_user.email && invited_user.email.casecmp(user.email).zero? user.email_confirmed = true user.signup_token = nil else diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index 19a574a8f..30500aca4 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -105,7 +105,7 @@ class UsersController < ApplicationController @fb_signup = load_facebook_signup(params) - # check if the email specified by @fb_signup already exists in the databse--if so, log them in and redirect + # check if the email specified by @fb_signup already exists in the database--if so, log them in and redirect if @fb_signup && @fb_signup.email user = User.find_by_email_and_email_confirmed(@fb_signup, true) if user @@ -117,7 +117,7 @@ class UsersController < ApplicationController end end - # check if the uid specified by @fb_signup already exists in the databse--if so, log them in and redirect + # check if the uid specified by @fb_signup already exists in the database--if so, log them in and redirect if @fb_signup && @fb_signup.uid user_authorization = UserAuthorization.find_by_uid_and_provider(@fb_signup.uid, 'facebook') # update user_authorization for user because this is fresher diff --git a/web/spec/features/signup_spec.rb b/web/spec/features/signup_spec.rb index 76d064fc2..3b11319a2 100644 --- a/web/spec/features/signup_spec.rb +++ b/web/spec/features/signup_spec.rb @@ -190,7 +190,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do describe "can signup with facebook link multiple times with same invite" do before do @user = FactoryGirl.create(:user) - @invited_user = FactoryGirl.create(:invited_user, :sender => @user, :autofriend => true, :email => "noone@jamkazam.com", :invite_medium => InvitedUser::FB_MEDIUM) + @invited_user = FactoryGirl.create(:invited_user, :sender => @user, :autofriend => true, :email => nil, :invite_medium => InvitedUser::FB_MEDIUM) end # Successful sign-in goes to the client