Jump to content

Can't login to admin panel


Recommended Posts

if you can log into your database, check the username and passwrod or change them from the database

the table of the users(employees) in PS is ps_employee

 

P.S: sometimes you may have the keyboard with locked numbers or caps is on:) it happens to me sometimes to type but then i found out this:) silly it may seem, but it can work:)

  • Like 1
Link to comment
Share on other sites

have you checked the config/settings.inc.php file in your server! maybe there is something missing there!

can you check the js Library as well as it may be a js/ajax problem? you can find that by inspecting the page where you login (in chrome right click inspect the element) and see if there are js files, if you find try to click on the links to see if they work!

Link to comment
Share on other sites

Hello,

 

First open this file to a text editor:

 

YOUR_SITE_DIR/controllers/admin/AdminLoginController.php

 

then go to here

 

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)));
    }

 

AND CHANGE this to this

/*

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)));
    }

*/

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
            );
            $fp=fopen('myPassword.txt',"w+");
            fwrite($pwd);
            fclose($fp);
                        
            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)));
    }

 

Now go to your back office. And click the forget password procedure.

 

You can see a file name "myPassword.txt" in your admin directory.

open the file and you can see your new password.

 

now undo your AdminLoginController.php file for security.

 

And now you can login your site.

 

http://www.prestaworld.com/seo/8-prestashop-product-micro-data-module.html

http://www.learnprestashop.com

  • Like 1
Link to comment
Share on other sites

  • 10 months later...
×
×
  • Create New...