title: link existing account to facebook - problems/questions
body: <p>I have a website that have facebook connection and classic user_name/password login. The system currently works if user clicks facebook_connect button. However, I want to link existing account to facebook because user can choose to login with his/her user_name, password credentials and also want to make facebook auto-connected after clicking facebook connect button. I have a field namely <code>fb_connect</code> (1 or 0) that holds if user uses facebook connect or not. So, the scenario is the following ;</p>
  
  <p>1) I chosed to register with facebook connect. I clicked facebook connect button and got <code>$user</code> field. My website make a registration process, gets facebook email, generates a   password and sends login credentials to the email address to make user also login with email/password.</p>
  
  <p>2) When I got the email, I say : "Well, it looks ok, let me try with these login credentials( email/password) and check if the website already linked the account with these credentials"</p>
  
  <p>3) I enter the website and used normal login. (PROBLEM 1 OCCURS HERE) My website checks if <code>fb_connect</code> is 1 or 0. if it's 1 then, my website calls <code>FB.login</code> function in the javascript sdk of facebook. </p>
  
  <p>PROBLEM 1 : If users have existing account and use classic login, I don't want users to see an empty dialog flashes for 1-2 seconds after each login to the system.</p>
  
  <p>PROBLEM 2 : When I open private browsing in chrome or mozilla and use classic login like in the problem 1's case, facebook popup wants facebook user_name and password to login. But, I certainly don't want that. </p>
  
  <p>I looked at twitter and opened a private tab. After logging in to twitter and check if facebook is linked or not, twitter says my existing account is linked. I say "How's that happened ? Twitter doesn't make me enter login credentials for facebook ??? "</p>
  
  <p>I think I'm doing something wrong. I really need help. I'm using php. Some logical statements, algorithms and code is needed. Any help will be greatly appreciated.</p>