Jump to content
camilolinares93

class AdminLoginControllerCore extends AdminController

Recommended Posts

Buenas noches requiero su colaboracion indicándome como debe colocar la siguientes lineas de texto que me arrojan un error 

 

public function processForgot()
    
        $email = trim(Tools::getValue('email_forgot'));
        if (empty($email))
            $this->errors[] = Tools::displayError('E-mail is empty');
        elseif (!Validate::isEmail($email))
            $this->errors[] = Tools::displayError('Invalid e-mail address');
        else
        {
            $employee = new Employee();
            if (!$employee->getByemail($email) || !$employee)
                $this->errors[] = Tools::displayError('This account does not exist');
            elseif ((strtotime($employee->last_passwd_gen.'+'.Configuration::get('PS_PASSWD_TIME_BACK').' minutes') - time()) > 0)
                $this->errors[] = sprintf(
                    Tools::displayError('You can regenerate your password only every %d minute(s)'),
                    Configuration::get('PS_PASSWD_TIME_BACK')
                );
        }
        if (_PS_MODE_DEMO_)
            $this->errors[] = Tools::displayError('This functionality has been disabled.');

        if (!count($this->errors))
        {    
            $pwd = Tools::passwdGen();
            $employee->passwd = md5(pSQL(_COOKIE_KEY_.$pwd));
            $employee->last_passwd_gen = date('Y-m-d H:i:s', time());

            $params = array(
                '{email}' => $employee->email,
                '{lastname}' => $employee->lastname,
                '{firstname}' => $employee->firstname,
                '{passwd}' => $pwd
            );
                        
            if (Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'password', Mail::l('Your new password', (int)Configuration::get('PS_LANG_DEFAULT')), $params, $employee->email, $employee->firstname.' '.$employee->lastname))
            {
                // Update employee only if the mail can be sent
                $result = $employee->update();
                if (!$result)
                    $this->errors[] = Tools::displayError('An error occurred during your password change.');
                else
                    die(Tools::jsonEncode(array(
                        'hasErrors' => false,
                        'confirm' => $this->l('Your password has been e-mailed to you', 'AdminTab', false, false)
                    )));
            }
            else
                die(Tools::jsonEncode(array(
                    'hasErrors' => true,
                    'errors' => array(Tools::displayError('An error occurred during your password change.'))
                )));
        
        }
        else if (Tools::isSubmit('ajax'))
            die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
    }
    }
}
 

image.png

image.png

Share this post


Link to post
Share on other sites

Hola:

Te falta la llave de apertura después de la función:

public function processForgot() {

Te recomiendo tener cuidado al modificar el código fuente del Prestashop. Podrias "romper" otras cosas.

Saludos

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More