-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document new password policy introduced in 8.0 #1593
Merged
kpodemski
merged 2 commits into
PrestaShop:8.x
from
thomasnares:documentNewPasswordPolicy
Feb 24, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: New password policy based on zxcvbn | ||
menuTitle: New password policy | ||
--- | ||
|
||
# New password policy introduced in 8.0.x | ||
|
||
A new password policy was introduced in 8.0.x for Customers and Employees passwords. | ||
|
||
This password policy is based on `Zxcvbn`. | ||
|
||
{{% notice note %}} | ||
`Zxcvbn` is a password strength estimation library that is designed to help developers create secure password policies for their applications. It was developed by DropBox and [is available as an open-source library](https://github.com/dropbox/zxcvbn). | ||
|
||
It estimates the strength of a password by analyzing various factors such as its length, the use of special characters, and the presence of common words or patterns. The goal of zxcvbn is to provide a more accurate and user-friendly way of assessing password strength compared to traditional approaches, which often rely on simple checks such as minimum length or the presence of certain types of characters. | ||
|
||
To use `Zxcvbn`, you provide the password as input to the library and it returns an estimated strength score. The score is a number between 0 and 4, with higher numbers indicating stronger passwords. This score is then used to provide feedback to users on the strength of their chosen password. | ||
{{% /notice %}} | ||
|
||
When creating / updating a `Customer` account, or an `Employee` account, the `Zxcvnb` api is used to determine the score, and make an instant feedback using Javascript to the `User`: | ||
|
||
![Password policy in back office for Employees](../img/password-policy-bo.png) | ||
|
||
![Password policy in front office for Customers](../img/password-policy-fo.png) | ||
|
||
## Changes introduced in PrestaShop by this new policy | ||
|
||
This new password policy introduced some backward compatibility breaks: | ||
|
||
* File `jquery-passy.js` is no longer available | ||
* Form field `change-password` is no longer working as it was for [passy](https://timseverien.github.io/passy/) integration | ||
* The password now requires a correct length whatever is it the Front or the Back Office | ||
* `AddEmployeeCommand` now requires `hasEnabledGravatar`, `minLength`, `maxLength` and `minScore` | ||
* `EditEmployeeCommand::setPlainPassword` now requires `minLength`, `maxLength` and `minScore` | ||
* `Employee\ValueObject::Password` now requires `minLength`, `maxLength` and `minScore` | ||
* `Employee/EmployeeType` now requires an instance of `ConfigurationInterface` | ||
* `ChangePasswordType` now requires an instance of `ConfigurationInterface` | ||
* `Core/Domain/Employee/ValueObject/Password::MIN_LENGTH` and `Core/Domain/Employee/ValueObject/Password::MAX_LENGTH` are no longer available | ||
* `Employee\ValueObject\Password::__construct` signature changed to `string $password, int $minLength, int $maxLength, int $minScore` | ||
* `PrestaShopBundle/Form/Admin/Type/ChangePasswordType::__construct` now require a `ConfigurationInterface` | ||
|
||
And some deprecations: | ||
|
||
* `Validate::isPlaintextPassword` is deprecated | ||
* `Validate::isPasswdAdmin` is deprecated | ||
|
||
{{% notice note %}} | ||
Please note that the library is loaded asyncronously in `core.js` because of its size. | ||
{{% /notice %}} | ||
|
||
## Upgrade guide for your module / theme | ||
|
||
### How to update your code for backend development | ||
|
||
If your module is creating / updating `Customers` or `Employees`, make sure to update your code according to the BC breaks and deprecations indicated above. | ||
|
||
### How to update your frontend theme | ||
|
||
If your theme is creating / updating `Customers` or `Employees`, make sure to update your code according to the BC breaks related to themes (`jquery-passy.js` no longer available, and form field `change-password` no longer working). | ||
|
||
If your theme is extending `PrestaShop/classic-theme`, | ||
|
||
- make sure your modifications (if any) to `template/customer/_partials/customer-form.tpl` does not change the `div` added around `password fields`: | ||
|
||
``` | ||
<div class="field-password-policy"> | ||
{form_field field=$field} | ||
</div> | ||
``` | ||
|
||
- make sure your modifications on your theme does not alter the requirement of `_partials/password-policy-template.tpl` in the Javascripts includes. | ||
|
||
- make sure your modifications on your theme does not alter the `templates/_partials/form-fields.tpl` file on the password field, [please refer here for requirements](https://github.com/PrestaShop/classic-theme/pull/21/files#diff-2b3eb6586609ac820d08cd566e45c06c2dd477060b2ffadeda1fb1d2941d69b7). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think it would be more interesting to document this from a system reference standpoint rather from a "how to update your software"? I think it could be overly specific otherwise.
Or perhaps the doc can be split in two: one which explains how the password policy is integrated with customers and employees (for reference), and another one that describes how to update existing code (useful for upgrade only).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this look better with the new commit ?