← Stef Development

Two-factor authentication (2FA) for the PrestaShop back office: enable, limit, lock down

A stolen password is all it takes to open your back office today. Here is what PrestaShop offers natively, what it lacks, and how to add a one-time code, a failed-login limit and an allowed-IP list without locking yourself out.

Updated on November 4, 2026 · Mustapha EL ATRASSI, Stef Development

Key points

  • PrestaShop has no native two-factor authentication for the back office: we checked the PrestaShop 8.2 and 9.0 code. You need a module.
  • No native failed-login limit either: a bot can try passwords with no delay imposed by PrestaShop.
  • TOTP (RFC 6238): a 6-digit code that changes every 30 seconds, generated by an app (Google Authenticator, Microsoft Authenticator…), no SMS.
  • Three complementary locks: one-time code, failed-login limit per IP, allowed-IP list for the back office.
  • Plan the way back in before switching on: recovery codes stored away from the phone, and FTP access.

Why turn on two-factor authentication on PrestaShop?

Short answer: because a password alone is no longer enough. It can be guessed, reused from another hacked site or stolen from an infected computer. With 2FA, a code from a device in your hand is also required.

The back office gives access to customers, orders and module installation. A stolen login can be used to export personal data or install malicious code on the shop. Two-factor authentication keeps the door shut even when the password has leaked.

What does PrestaShop offer natively to secure logins?

Short answer: a password policy, cookie settings and session management. No second factor, no failed-login limit, no back-office IP list.

Native settingWhereWhat it gives you
Password policy (length, minimum score)Advanced Parameters › Security (PrestaShop 8 and 9)Rejects weak employee and customer passwords.
Employee sessionsAdvanced Parameters › SecuritySee and delete open sessions.
“Check the cookie’s IP address”Advanced Parameters › AdministrationMakes a stolen cookie useless from another IP; logs you out if your IP changes often.
Lifetime of back office cookiesAdvanced Parameters › AdministrationShortens a “stay logged in” session.
Admin folder nameSet at installationMakes the login address less obvious, without really protecting it.
UpdatesUpdate assistantFixes published vulnerabilities; PrestaShop’s security policy says fixes usually target the latest release.
Even well configured, PrestaShop accepts a correct password from any IP, with no second factor and no delay after repeated failures.

How does a TOTP code work?

Short answer: the shop and your phone share a secret, sent once through a QR code. Every 30 seconds, each side computes the same 6-digit code from that secret and the time. Nothing goes through SMS.

  • The method is standardised by RFC 6238, which recommends a 30-second time step and at most one step of tolerance for network delay.
  • The RFC also requires that a code already accepted is not accepted a second time.
  • The QR code holds an otpauth:// address that the app reads, for example:
otpauth://totp/My%20shop:mary%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=My%20shop

The phone must keep accurate time: turn on automatic time. A TOTP app works offline.

Manual protections: IP list and folder name

Short answer: without a module, you can restrict the admin folder to your IPs with an .htaccess file. It is strong, but rigid if your IP changes.

# .htaccess file in the admin folder (Apache 2.4)
# Only these addresses can open the back office
Require ip 203.0.113.10
Require ip 198.51.100.0/24
Require ip 2001:db8:1:1::/64
  • Several Require ip lines: only one needs to match. Accepted forms (single IP, CIDR network, IPv6) are described in the Apache documentation.
  • Home broadband IPs change often: you may lock yourself out. Keep FTP access to fix the file.
  • Behind Cloudflare or another proxy, the server sees the proxy’s IP: the rule does not work without extra setup.
  • Renaming the admin folder is not protection: the address can leak (history, browser extensions, contractors).
MeasureAgainst a stolen passwordAgainst mass guessingRisk of locking yourself out
Password policyNoPartlyNone
Folder nameNoPartlyNone
IP list (.htaccess)Yes, outside your IPsYesHigh with a dynamic IP
Failed-login limit per IPNoYesLow (limited wait)
TOTP two-factor authenticationYesYesLow with recovery codes

Turn on back-office 2FA with Block IPs

Short answer: Block IPs adds a TOTP code after the password, 10 recovery codes, a failed-login limit, an allowed-IP list, e-mail alerts and a login journal to the back office. PrestaShop 1.7.8 or later, including the PrestaShop 9 login.

Turn on two-factor authentication for your account

  1. Open Block IPs › Back office.
  2. Click “Turn on for my account” and scan the QR code with your app (Google Authenticator, Microsoft Authenticator or another TOTP app).
  3. Enter the 6-digit code to confirm.
  4. Store the 10 recovery codes away from the phone (password manager, paper under lock). Each one works once.
  5. Log out and back in: after the password, the code page appears.

Require 2FA for a team

Under “Mandatory for these profiles”, tick the employee profiles concerned. At their next login, those employees must set up their app before they can open any page. Turn it on for your own account first.

Limit login attempts

On by default: 5 failures in 15 minutes (password or code) per IP. Beyond that, the IP waits for the length of the window, and the login page says so clearly. White-listed and allowed IPs are never limited. Both values can be changed.

Restrict the back office to your IPs

One IP or CIDR range per line, IPv4 or IPv6. The module refuses to save a list that does not include your current IP, so you cannot lock yourself out. Behind Cloudflare, it reads the visitor’s real IP when the connection comes from a recognised Cloudflare network.

Alerts and journal

  • E-mail on a login from an unknown device (IP and browser not seen for 90 days).
  • E-mail when an IP reaches the failed-login limit.
  • E-mail when a recovery code is used or two-factor authentication is removed from an account.
  • Login journal: successes, failures, codes, refused IPs.

The rest of the module protects the shop itself: AI crawlers, countries, IPs and fake customer accounts. Full overview on the Block IPs module page.

What if I lose my phone or lock myself out?

Short answer: three ways back in, from simplest to most radical.

  1. A recovery code instead of the TOTP code. An e-mail alert reports its use.
  2. Another administrator resets your two-factor authentication in the employee list (“Reset (lost phone)”).
  3. The rescue file: upload an empty file named BLOCKIPS-RESCUE by FTP to modules/blockips/. Every back-office (and sign-up) protection is suspended while it is there. Log in, fix the problem, then delete the file.
Check that you really have FTP or SFTP access to your hosting before turning on two-factor authentication.

Back-office login checklist

  1. PrestaShop and modules up to date.
  2. One named account per employee, with the most restricted profile possible.
  3. Password policy on (PrestaShop 8 and 9).
  4. TOTP two-factor authentication for every administrator profile.
  5. Failed-login limit on (5 in 15 minutes by default in Block IPs).
  6. Allowed-IP list if your team has fixed IPs.
  7. Recovery codes stored, FTP access tested.
  8. E-mail alerts sent to an address read every day.

Lock down your back office with Block IPs

TOTP two-factor authentication with 10 recovery codes, mandatory per profile, failed-login limit, allowed IPs, alerts and journal, on PrestaShop 1.7.8 to 9. Shop firewall and fake-account protection included (€69.99 excl. VAT on PrestaShop Addons). See the module overview.

See Block IPs on PrestaShop Addons

Frequently asked questions

Does PrestaShop have native two-factor authentication?

Not for the back office: the PrestaShop 8.2 and 9.0 code has none. You need a module such as Block IPs, which adds a TOTP code after the password on PrestaShop 1.7.8 to 9.

Which app should I use for PrestaShop 2FA?

Any TOTP app compliant with RFC 6238: Google Authenticator, Microsoft Authenticator or a password manager that generates TOTP codes.

How do I limit login attempts to the PrestaShop back office?

PrestaShop does not do it natively. Block IPs blocks an IP after 5 failures in 15 minutes by default (adjustable), with a clear message and an e-mail alert.

What if I lost my phone?

Use a recovery code, ask another administrator to reset your 2FA, or upload an empty BLOCKIPS-RESCUE file by FTP to modules/blockips/, then delete it afterwards.

Can the allowed-IP list lock me out?

Block IPs refuses to save a list that excludes your current IP. If your IP changes later, the BLOCKIPS-RESCUE file opens access again.

Is the code asked every time?

It is asked at every new back-office login. A session already validated is not interrupted.

Official sources

This guide is for information only. Test every change (login, sign-up, checkout) and keep a backup before editing .htaccess or robots.txt.