Page 1 of 1
calling the password creation script?
Posted: Sat Jan 28, 2012 4:54 am
by Daddio
hello, I would like to create details for opencart customers out side of opencart, so they have customer ids in the mysql database that is linked to my shop, so they could go to the shop later for the first time and login as an existing customer.
I can write information into the relevant fields in the database except for the password field of the customer table.
Is there a way either to make a call to the part of the opencart script that creates password code or is there a way to allow some customers to login without a password?
Kindest regards
Adrian ( A Daddio!)
Re: calling the password creation script?
Posted: Sun Jan 29, 2012 12:53 am
by straightlight
The specific part you'd be looking for where it originally stores password upon customers registration would be in: catalog/model/account/customer.php file:
Code: Select all
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int)$this->config->get('config_store_id') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', password = '" . $this->db->escape(md5($data['password'])) . "', newsletter = '" . (isset($data['newsletter']) ? (int)$data['newsletter'] : 0) . "', customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "', status = '1', date_added = NOW()");
and here:
Code: Select all
$this->db->query("UPDATE " . DB_PREFIX . "customer SET password = '" . $this->db->escape(md5($password)) . "' WHERE email = '" . $this->db->escape($email) . "'");
Then, within this method in system/library/customer.php file:
Code: Select all
public function login($email, $password, $override = false) {
and within this method in system/library/user.php file:
Code: Select all
public function login($username, $password) {