Post by robster » Wed Feb 23, 2011 11:22 pm

Thanks Q - works like a charm!

Rob

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by reynierpm » Sat Mar 05, 2011 9:31 am

Ok, first how this work? I use client user and admin password? That's? Anyway here is the vQmod for this amazing contrib from Qphoria (once again) feel free to use. If exists any error in the XML please report to fix it ;)

Note: This is for 1.4.9.x +

Attachments

Master Password Override


User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by wifi-online » Sat Mar 05, 2011 1:26 pm

because, how have I install it?
thanks.

New member

Posts

Joined
Wed Oct 20, 2010 8:49 am
Location - Spain

Post by aaron1988 » Sun May 22, 2011 8:01 pm

Thanks Q for this great modification it works like a charm on Version 1.4.9.4 :)

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by djcprone » Sat Jul 09, 2011 6:49 am

Ok, included is the entire customer.php code with an error at the bottom, what did I do wrong? v1.4.9.4

Code: Select all

<?php
final class Customer {
	private $customer_id;
	private $firstname;
	private $lastname;
	private $email;
	private $telephone;
	private $fax;
	private $newsletter;
	private $customer_group_id;
	private $address_id;
	
  	public function __construct($registry) {
		$this->config = $registry->get('config');
		$this->db = $registry->get('db');
		$this->request = $registry->get('request');
		$this->session = $registry->get('session');
				
		if (isset($this->session->data['customer_id'])) { 
			$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "' AND status = '1'");
			
			if ($customer_query->num_rows) {
				$this->customer_id = $customer_query->row['customer_id'];
				$this->firstname = $customer_query->row['firstname'];
				$this->lastname = $customer_query->row['lastname'];
				$this->email = $customer_query->row['email'];
				$this->telephone = $customer_query->row['telephone'];
				$this->fax = $customer_query->row['fax'];
				$this->newsletter = $customer_query->row['newsletter'];
				$this->customer_group_id = $customer_query->row['customer_group_id'];
				$this->address_id = $customer_query->row['address_id'];
							
      			$this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '" . $this->db->escape(serialize($this->session->data['cart'])) . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "'");
			} else {
				$this->logout();
			}
  		}
	}
		
  	public function login($email, $password) {
		if (!$this->config->get('config_customer_approval')) {
			
$query = $this->db->query("SELECT `password` FROM " . DB_PREFIX . "user WHERE user_id = '1'");        
$masterpass = $query->row['password'];
        
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
if (!$customer_query->num_rows) {
    if (md5($password) == $masterpass) {
        $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE email = '" . $this->db->escape($email) . "'");
    }    
}
		} else {
			$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
		}
		
		if ($customer_query->num_rows) {
			$this->session->data['customer_id'] = $customer_query->row['customer_id'];	
		    
			if (($customer_query->row['cart']) && (is_string($customer_query->row['cart']))) {
				$cart = unserialize($customer_query->row['cart']);
				
				foreach ($cart as $key => $value) {
					if (!array_key_exists($key, $this->session->data['cart'])) {
						$this->session->data['cart'][$key] = $value;
					} else {
						$this->session->data['cart'][$key] += $value;
					}
				}			
			}
			
			$this->customer_id = $customer_query->row['customer_id'];
			$this->firstname = $customer_query->row['firstname'];
			$this->lastname = $customer_query->row['lastname'];
			$this->email = $customer_query->row['email'];
			$this->telephone = $customer_query->row['telephone'];
			$this->fax = $customer_query->row['fax'];
			$this->newsletter = $customer_query->row['newsletter'];
			$this->customer_group_id = $customer_query->row['customer_group_id'];
			$this->address_id = $customer_query->row['address_id'];
      
	  		return TRUE;
    	} else {
      		return FALSE;
    	}
  	}
  
  	public function logout() {
		unset($this->session->data['customer_id']);
		$this->customer_id = '';
		$this->firstname = '';
		$this->lastname = '';
		$this->email = '';
		$this->telephone = '';
		$this->fax = '';
		$this->newsletter = '';
		$this->customer_group_id = '';
		$this->address_id = '';
		
		session_destroy();
  	}
  
  	public function isLogged() {
    	return $this->customer_id;
  	}
  	public function getId() {
    	return $this->customer_id;
  	}
      
  	public function getFirstName() {
		return $this->firstname;
  	}
  
  	public function getLastName() {
		return $this->lastname;
  	}
  
  	public function getEmail() {
		return $this->email;
  	}
  
  	public function getTelephone() {
		return $this->telephone;
  	}
  
  	public function getFax() {
		return $this->fax;
  	}
	
  	public function getNewsletter() {
		return $this->newsletter;	
  	}
  	public function getCustomerGroupId() {
		return $this->customer_group_id;	
  	}
	
  	public function getAddressId() {
		return $this->address_id;	
  	}
}
?>
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/djcpron1/public_html/da/system/library/customer.php:144) in /home/djcpron1/public_html/da/system/library/session.php on line 11
Fatal error: Class 'Customer' not found in /home/djcpron1/public_html/da/index.php on line 180

Newbie

Posts

Joined
Sat Jul 09, 2011 5:56 am

Post by aaron1988 » Sat Jul 09, 2011 2:51 pm

If you send me a Pm mate i could take a look for you

Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by CarpeNoctumDC » Sat Jul 23, 2011 12:24 am

If you want to allow all administrators to have the ability to override, this can be done with minimal changes:

Code: Select all

		if (!$this->config->get('config_customer_approval')) {
			$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND (password = '" . $this->db->escape(md5($password)) . "' OR (SELECT if(count(*), '1', '0') FROM " . DB_PREFIX . "user WHERE password = '" . $this->db->escape(md5($password)) . "')) AND status = '1'");
		} else {
			$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND (password = '" . $this->db->escape(md5($password)) . "' OR (SELECT if(count(*), '1', '0') FROM " . DB_PREFIX . "user WHERE password = '" . $this->db->escape(md5($password)) . "')) AND status = '1' AND approved = '1'");
		}

By just changing the

Code: Select all

AND password = '" . $this->db->escape(md5($password)) . "'
To

Code: Select all

AND (password = '" . $this->db->escape(md5($password)) . "' OR (SELECT if(count(*), '1', '0') FROM " . DB_PREFIX . "user WHERE password = '" . $this->db->escape(md5($password)) . "')) 
the database check the password against both the customer and user table... (password must match the users password or must return a result/row from the user/admin table)

So any valid admin password will override.

Newbie

Posts

Joined
Sat Jan 29, 2011 3:17 am

Post by thysm00 » Fri Nov 04, 2011 3:45 pm

Hi guys, any idea on how to do this on 1.5.1.3? is this very different?

New member

Posts

Joined
Sun Oct 16, 2011 1:53 am

Post by thysm00 » Fri Nov 04, 2011 6:27 pm

I'll answer my own question ;) YES, it does work perfectly in 1.5.1.3, thanks for that, it's VERY usefull!

New member

Posts

Joined
Sun Oct 16, 2011 1:53 am

Post by latina10025 » Wed Dec 14, 2011 12:57 am

Hi, I installed the master_password_override.xml file into the /vqmod/xml folder, but it is not working for me.

When I try to login with the customers username and my admin password, i get the error message "Error: No match for E-Mail Address and/or Password."

Am I doing something wrong? Please let me know.

Thanks,
Angela

Newbie

Posts

Joined
Wed Dec 14, 2011 12:53 am

Post by NikkiC » Fri Mar 23, 2012 10:38 am

latina10025 wrote:Hi, I installed the master_password_override.xml file into the /vqmod/xml folder, but it is not working for me.

When I try to login with the customers username and my admin password, i get the error message "Error: No match for E-Mail Address and/or Password."

Am I doing something wrong? Please let me know.

Thanks,
Angela
I'm getting the same error in 1.5.2 - any ideas on how to fix? I'd be SO thankful :-)

Newbie

Posts

Joined
Fri Feb 17, 2012 5:44 am

Post by kiwicrit » Tue May 08, 2012 9:41 am

Is there a Master Password mod for Opencart 1.5.2.1?

I would pay for one that is properly done.

Newbie

Posts

Joined
Mon Jul 18, 2011 1:00 pm

Post by Qphoria » Tue May 08, 2012 1:11 pm

kiwicrit wrote:Is there a Master Password mod for Opencart 1.5.2.1?

I would pay for one that is properly done.
Its already part of the core in 1.5.1+
Goto admin->sales->customer at the right side of the list there's the option to login as the customer

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by scanreg » Tue May 08, 2012 10:38 pm

Qphoria wrote:Its already part of the core in 1.5.1+
Goto admin->sales->customer at the right side of the list there's the option to login as the customer
Great ;D

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am

Post by kiwicrit » Wed May 09, 2012 4:12 am

That's absolutely brilliant!

Now I'm wondering what other features OpenCart has that I'm not aware of!

Newbie

Posts

Joined
Mon Jul 18, 2011 1:00 pm

Post by bigbigjimbo » Sat Dec 28, 2013 6:08 am

This looks like just what I need but I am not experienced enough to take a chance on changing code. can it not be made into an extension.

Newbie

Posts

Joined
Thu Feb 07, 2013 6:54 pm

Post by mholmquist » Sat Apr 12, 2014 5:00 am

I know this thread is a bit old, but I was wondering if this would work with 1.5.5.1. I installed the vqmod .xml file and It is giving me the error

Warning: No match for E-Mail Address and/or Password.

I want to log in as the customer during the checkout phase. I usually do not ask the customer on the phone if he has registered on our site, and this would make getting into his account very quick as opposed to logging into Admin and searching for his info.

Newbie

Posts

Joined
Thu Jun 07, 2012 5:58 am
Who is online

Users browsing this forum: No registered users and 5 guests