1

I have a live and testing servers. I have cloned my live website to the development stack and have some problem when trying to access it.

I have edited the local machine hosts file and mapped the DNS, however when trying to access the website it was redirecting to the live website. I managed to fix this by editing 4 rows in my core_config_data table for my development site:

web/unsecure/base_url       -> http://dev.mydomain.com

web/secure/base_url         -> http://dev.mydomain.com

web/unsecure/base_link_url  -> http://dev.mydomain.com

web/secure/base_link_url    -> http://dev.mydomain.com

However, if I navigate to the dev.mydomain/admin and try to log in, it gives me error that the username or password is incorrect or the account has been temporary disabled.

I had similar problem with Magento 1 and fixed it by either commenting out these lines in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:

$cookieParams = array(
    'lifetime' => $cookie->getLifetime(),
    'path'     => $cookie->getPath()
    // 'domain'   => $cookie->getConfigDomain(),
    // 'secure'   => $cookie->isSecure(),
    // 'httponly' => $cookie->getHttponly()
);

Or running a query in MySQL client:

 DELETE FROM core_config_data WHERE path = "web/cookie/cookie_domain";
 DELETE FROM core_config_data WHERE path LIKE "web/secure/base%";
 DELETE FROM core_config_data WHERE path LIKE "web/unsecure/base%";

Anyone know how to solve the problem with Magento ver 2.1.8?

3 Answers 3

5

This might be user issue where the user might be disabled, or it might be cookie issue.

Unlock the user first and try to login

php bin/magento admin:user:unlock

Try to set cookie domain web/cookie/cookie_domain = ".mydomain.com"

Also try to save session on Database or under /tmp how to locate sessions: http://devdocs.magento.com/guides/v2.0/config-guide/sessions.html

Do a full reindex of Magento.

Try to create another user using

php bin/magento admin:user:create 

Do cache clean and cache flush.

php bin/magento cache:flush
php bin/magento cache:flush
3
  • The web/cookie/cookie_domain should be set to my dev site or live site? Should it be like ".dev.mydomain.com`?
    – Greg
    Commented Feb 9, 2018 at 12:11
  • if you have url of the local website dev.domain.com then the cookie domain should be .domain.com even if you have the url of the local website domain.com the cookie domain should be .domain.com Commented Feb 9, 2018 at 12:13
  • 1
    created new user and re-indexed, it worked! Thanks mate!
    – Greg
    Commented Feb 9, 2018 at 12:18
0

You can check

admin_user

table in your db. There is a

is active

column. Check it.

1
  • The account is set to 1 so it is active.
    – Greg
    Commented Feb 9, 2018 at 12:08
0

You can simply create a new User through SSH:

php bin/magento admin:user:create --admin-user='user1' --admin-password='admin123' --admin-email='[email protected]' --admin-firstname='Admin' --admin-lastname='Admin'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.