58 votes

Magento 2: How to reset Customer Password from Database

This SQL works just fine to update the customer password. Tested with Magento 2.1.5. Just change "YOURPASSWORD" below (keep the xxx:es) and voila! UPDATE `customer_entity` SET `password_hash` = ...
Robban's user avatar
  • 781
58 votes
Accepted

Magento 2: How to reset Customer Password from Database

Never thought of using SHA hashing in SQL directly until I saw Robban's answer. I'd like to add that you could generate the salt hash in SQL too, leaving only the password that should be added. You ...
7ochem's user avatar
  • 7,532
28 votes

How to change default Magento admin password expiration period?

You can do this by following CLI commands php bin/magento config:set admin/security/password_lifetime 0 php bin/magento config:set admin/security/password_is_forced 0 php bin/magento c:f This ...
Magemad's user avatar
  • 291
18 votes

Magento 2 How to change password length validation?

This is a configuration item. In Stores > Configuration > Customers > Customer Configuration > Password Options there's some options like Password Length and Number of Required Character ...
Jacques's user avatar
  • 1,026
15 votes

Magento 2 - Change customer password programmatically

The save method of the class Magento\Customer\Model\ResourceModel\CustomerRepository has an extra argument passwordHash Use this argument to set a new password: $customer = $this->...
Vladimir Kerkhoff's user avatar
14 votes

How to change default Magento admin password expiration period?

you can also do this thing by CLI: php bin/magento config:set admin/security/password_lifetime 0 also make sure you clear your cache: php bin/magento cache:clean
Charvi Parikh's user avatar
13 votes

How to encrypt password in Magento 2?

Firstly my usual comment would be, do not encrypt a password! Encryption = A two-way process, scrambling and then unscrambling data at a later date. Hashing = A one-way process, create an encrypted ...
Luke Rodgers's user avatar
  • 4,442
9 votes

Magento 2: How to reset Customer Password from Database

You can generate a Magento 2 style password hash quite easily via PHP on command line (CLI). Use this command to generate a hash, as example for password test123 (change that into your own password): ...
7ochem's user avatar
  • 7,532
9 votes
Accepted

Update customer password directly in database

Try this: Replace testtest with your new password and $customer_entity_id with the customers entity_id in the customer_entity table. update customer_entity_varchar set value = md5('testtest') where ...
Yogesh Agarwal's user avatar
8 votes
Accepted

Magento 2 How to change password length validation?

We can use jQuery validation in Magento 2. You can add this file in '.phtml' or '.js' file. Let’s see how we can do this. 1) In input or select tag add our validation with this code: data-validate="...
Arunendra's user avatar
  • 7,436
8 votes
Accepted

Magento customer reset password customer_flowpassword error

Solution 1 Go to database table core_resource, Find an entry for your module- could be customer_flowpassword_setup - and delete it. Now refresh any page on your magento setup. It should re-run your ...
Jaimin Sutariya's user avatar
8 votes

Magento customer reset password customer_flowpassword error

This is a bug in Magento core, not recognizing your "table prefix" (confimed here) See: /app/code/core/Mage/Customer/Model/Observer.php Original code doesn't check for prefix ... public function ...
sv3n's user avatar
  • 11.6k
8 votes

Magento2 How to add custom validation for password?

If you want to validate customer login password then override phtml file in to your design folder like below. app/design/frontend/vendor/theme/Magento_Customer/templates/form/login.phtml Find the ...
Chirag Patel's user avatar
  • 6,116
7 votes
Accepted

2 Step Authentication for admin URL

It seems you want to add a .htaccess directory protection. Ad there is no real admin folder, you need to work around this: SetEnvIfNoCase Request_URI "^/admin/" ADMIN AuthType Basic AuthName "...
Anna Völkl's user avatar
  • 17.3k
7 votes

Magento 2: How to reset Customer Password from Database

I don't think it's possible to set the password from inside the DB. You need SHA256 hashing for customer passwords. Here's how Magento generates it: example password in DB: ...
Aaron Allen's user avatar
  • 9,009
7 votes

How to apply simpler password constraints for customers in magento 2

Thanks Ankit Shah, Solution here : https://magento.stackexchange.com/a/141422/43576 "As of version 2.1.1 this is a configuration item. In Stores > Configuration > Customers > Customer Configuration >...
Gael COAT's user avatar
  • 387
7 votes
Accepted

Magento 2: How to Send Reset Password Mass Email to Customers Programmatically

From Outside Magento. If you want to send All Customers Reset Password Email, then below is the code. //place this before any script you want to calculate time $time_start = microtime(true); // ...
Jackson's user avatar
  • 9,889
7 votes
Accepted

How to encrypt password in Magento 2?

I searched a little and found out that magento2 uses EncryptorInterface class to encrypt and decrypt the password. You can use it this way: use Magento\Framework\Encryption\EncryptorInterface as ...
Seefan's user avatar
  • 540
6 votes
Accepted

Error when updating Magento admin password: Sorry, but this password has already been used. Please create another

I was able to resolve this issue by going into the admin_passwords table, and removing the stored passwords associated with the admin users' ID. Not sure if this was the right way to go about it, but ...
codestr's user avatar
  • 495
6 votes

Magento 2: When/Why to do customer:hash:upgrade?

Let's say you installed Magento 2 that has the following constants: /** * Key of md5 algorithm */ const HASH_VERSION_MD5 = 0; /** * Key of sha256 algorithm */ const HASH_VERSION_SHA256 = 1; /** ...
Raphael at Digital Pianism's user avatar
6 votes

Magento 2: When/Why to do customer:hash:upgrade?

As @Raphael at Digital Pianism mention, It helps to increase customer security(Password security), you can check below code what Magento actually does when you run this command, $this->collection ...
Keyur Shah's user avatar
6 votes

Something went wrong while saving the new password Magento 2

This is an issue in Magento 2.2.6 (check here) This patch fixes it. In app/code/Magento/Customer/Model/AccountManagement.php, in function resetPassword: BEFORE $this->sessionManager->...
Arnaud's user avatar
  • 320
6 votes
Accepted

Magento2 How to add custom validation for password?

@chirag, Thanks for your suggestion and from your suggestion i have made changes in register.phtml file and now my requirement is working. Please check below my code. app/design/frontend/Custom/...
Ronak's user avatar
  • 797
5 votes

Magento 2 - Change customer password programmatically

I had similar problem. I needed to check the hash from the old web site, and if everything is ok - change customer password and authenticate it on frontend (save "new" password to DB). My solution: ...
Roman Shopin's user avatar
5 votes

magento 1.9 save password both md5 and salt

Actually i think it should be enough to update the password when a customer signs up via register when a customer signs up during checkout after a password change in the customer acount after a ...
Anna Völkl's user avatar
  • 17.3k
5 votes

Magento 2: How to reset Customer Password from Database

Just try the below mysql query update customer_entity set password_hash = CONCAT(md5('test123'),"::0") where entity_id = 233; Where entity_id is your user id There are 3 values separated by : sign ...
AbdulBasit's user avatar
5 votes

Magento 2: How to reset Customer Password from Database

Please look at this, if you want to do this from SQL queries, and if you are using Magento 2.4.0 and above, by logging into the PHPMyAdmin or from SSH, and find the table customer_entity and select ...
Bharath Kumar's user avatar
5 votes

Magento 2 password format

This is the method that hashes a password: public function getHash($password, $salt = false, $version = self::HASH_VERSION_LATEST) { if ($salt === false) { return $this->hash($password)...
Marius's user avatar
  • 198k
5 votes
Accepted

Customer can't edit his information without entering current password

You have to change app/code/core/Mage/Customer/controllers/AccountController.php For this behavoir these lines have to be moved after if ($customer->getIsChangePassword()) { if (!$customer->...
sv3n's user avatar
  • 11.6k

Only top scored, non community-wiki answers of a minimum length are eligible