[eluser]Dacus[/eluser]
Just found a
critical error in
models/user_model.php file, see function
get_user_by_email(). I will try to explain it in my poor English.
There it is used a SQL query with so called theta-join on two tables,
users and
user_profiles, which have both the
id field:
Code:
SELECT * FROM users u, user_profiles up
Value from the
id field from second table overrides the value from the same field from the first table, therefore the following code from
controllers/auth_other.php (function
fill_user_info()) is wrong:
Code:
$new_user = $this->user_model->get_user_by_email($email);
$user_id = $new_user[0]->id;
Instead of user ID the $user_id variable will contain user profile ID!
If by some reason both IDs, for user and for his profile, are not the same (sooner or later they will not be) than the Facebook/Twitter/GFC IDs for all new users will be assigned to wrong users! What will happen next I think everyone understands (users logging in to wrong accounts and huge problems for administrators).
Proposed solution 1
In
controllers/auth_other.php, function
fill_user_info(), replace
Code:
$user_id = $new_user[0]->id;
with
Code:
$user_id = $new_user[0]->user_id;
Proposed solution 2
In
models/user_model.php, function
get_user_by_email(), replace
Code:
SELECT * FROM users u, user_profiles up
with
Code:
SELECT u.*, up.country, up.website, up.facebook_id, up.twitter_id, up.gfc_id FROM users u, user_profiles up
Any other proposals?