EQ10000 Posted December 12, 2011 Share Posted December 12, 2011 Hi core team, I would like to suggest to let us override authController easier. Please conside to implement the following way in future version. In this way, we create a new method instead to call mail send in the middle of the main portion directly. /** Need to add extra fields to e-mail send, override this method. */ public function authMailSend($customer) { /** out from line 167 for override, add extra fields */ return Mail::Send((int)(self::$cookie->id_lang), 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname); } Then, under : if (Tools::isSubmit('submitAccount') OR Tools::isSubmit('submitGuestAccount')) { /** modify line 167 */ if (!$customer->is_guest) { if (!authMailSend()) $this->errors[] = Tools::displayError('Cannot send email'); } self::$smarty->assign('confirmation', 1); Link to comment Share on other sites More sharing options...
EQ10000 Posted December 14, 2011 Author Share Posted December 14, 2011 Let me suggest using one more method for authController. /** Override this method if you have to check extra field in custom customer. */ public function getAuthentication($customer, $email, $passwd) { $authentication = $customer->getByEmail(trim($email), trim($passwd)); if (!$authentication OR !$customer->id) { /* Handle brute force attacks */ sleep(1); $this->errors[] = Tools::displayError('Authentication failed'); return false; } return true; } So, under if (Tools::isSubmit('SubmitLogin')) ... $customer = new Customer(); if (getAuthentication($customer,$email,$password)) /** overridible*/ { Link to comment Share on other sites More sharing options...
bellini13 Posted December 21, 2011 Share Posted December 21, 2011 i second that. it would be a more flexible system if the developer did not have to override entire functions, only to change 1 or 2 lines. it would be good to refactor some controllers so that those important coding lines are their own functions with default implementations that could then be overridden. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now