benedmunds/CodeIgniter-Ion-Auth — Issue #160: ion_auth_model.php - login() query fails with Postgre
Author: cutnpaster
Created: 2012-01-19 21:06:31+00:00
State: open

Hi,
I'm using Postgre database driver.

ERROR: column "admin@admin.com" does not exist at character 101
STATEMENT: SELECT "username", "email", "id", "password", "active", "last_login"
FROM "users"
WHERE (username = "admin@admin.com" OR email = "admin@admin.com")
LIMIT 1

Line 663 of models/ion_auth_model.php fails at login. The parameters in the where() clause should be single quoted instead of double quoted.

This line fixed it in Postgre 9.1, and it also appears to work with Mysql.

->where(sprintf("(username = '%1\$s' OR email = '%1\$s')", $this->db->escape_str($identity)));