Password Policy depends on the CTools module for one single configuration form in the backend: PasswordPolicyWizard. This has the drawback that I now have tons of unnecessary CTools code running in my project, and I get all its bugs for free.

1) Remove ctools depedency
2) Attach screenshots from the changes.
3) Check if the new form to create/edit the Password Policy is user-friendly.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen created an issue. See original summary.

AohRveTPV’s picture

Version: 8.x-1.x-dev » 8.x-3.x-dev

Should probably remove the 8.x-1.x branch too...

AohRveTPV’s picture

It seems like it'd add a fair amount of complexity to do as you suggest: Use a wizard if CTools is installed and fall back to a single form otherwise.

The CTools entity form wizard API requires specifying a form for each step. So falling back to a single form would seem to require each of the three existing forms having methods that can be called to return the contents of that form. Then you could have a new form class that calls each of those methods to put together the entire form.

In my opinion the root problem is CTools is monolithic, too large a dependency. We should be able to place a dependency on a module/library that provides only a form wizard, instead of placing a dependency on all of CTools. But I don't think there exists such an option.

I think adding fallback for no CTools would be unnecessary complexity in this module (since it seems fairly complex as I described above). I think the better choices would be to (1) find/create/wait on a lighter-weight dependency that provides a form wizard, or (2) abandon wizard and just use single form to eliminate the CTools dependency.

Just my initial thoughts, I've hardly done D8 development so I defer to nerdstein.

pfrenssen’s picture

Maybe we can split off the configuration UI in a separate submodule, similar to the Views UI module? Would that be easier?

The UI submodule can then have a dependency on CTools, and we can deploy the config to production without having to enable the UI and CTools. Nobody has any business changing configuration settings on a live production instance anyway.

FYI I'm currently working around it by simply removing the dependency from the info.yml file.

AohRveTPV’s picture

I like that idea. Other modules have that design too, like Rules. Turning off the configuration UIs in production reduces attack surface.

DanielVeza’s picture

This hasn't been updated in 4 years. Lets review if we can do this better & without ctools.

We maintain the distribution Sector, which needs ctools just because of this module. I'd love to be able to remove ctools.

paulocs’s picture

Assigned: Unassigned » paulocs
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Active » Needs review
FileSize
47.61 KB

I created a submodule called password_policy_ui and removed the ctools dependecy.

Status: Needs review » Needs work

The last submitted patch, 8: 2877040-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

paulocs’s picture

Status: Needs work » Needs review
FileSize
4.77 KB
52.71 KB

Fixing remaining tests.

larisse’s picture

FileSize
41.86 KB
52.08 KB

Hi! The patch breaks my site.

I have some policies in my site, and after that I applied the patch, it breaks my site.
You can see the error in the image.

obs: when I apply the patch I get a warning (I will let the image too).

larisse’s picture

Status: Needs review » Needs work
paulocs’s picture

Status: Needs work » Needs review
FileSize
766 bytes
53.68 KB

Hi @larisse!
Thanks for the review. The problem is the menu link in password_policy.links.menu.yml.
I wrote a new patch.

Cheers,
Paulo.

larisse’s picture

Status: Needs review » Reviewed & tested by the community

Hi @paulocs! Now the patch works correctly. Changing to RTBC.

I still receive the follow warning when I apply the patch.

2877040-13.patch:24: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

paulocs’s picture

Status: Reviewed & tested by the community » Needs work

There are some code standard problems #13...
We need to address it before commit and we should have more people testing it, as this is a big change.

I wonder if @DanielVeza can test it as well as he recently commented in the issue.

DanielVeza’s picture

Just for clarity - Does the Password policy UI module need ctools or has that been 100% removed? If it's been removed I'm a big fan!

paulocs’s picture

The dependency was completely removed.

hmendes’s picture

Status: Needs work » Needs review
FileSize
59.69 KB
25.04 KB

Adding a new patch to fix coding standards from #13 and add a hook_update to install the password_policy_ui.
Please review.

hmendes’s picture

Adding a new patch. No interdiff as previous patches no longer apply.

Status: Needs review » Needs work

The last submitted patch, 19: 2877040-19.patch, failed testing. View results

hmendes’s picture

Trying to fix the errors reported.

hmendes’s picture

Status: Needs work » Needs review

Changing to Needs review as it passed the tests.

hswong3i’s picture

Status: Needs review » Needs work

The last submitted patch, 23: password_policy-remove_ctools-2877040-23.patch, failed testing. View results

huriellopes’s picture

Assigned: Unassigned » huriellopes

I work in the issue!

huriellopes’s picture

Assigned: huriellopes » Unassigned
Status: Needs work » Active
paulocs’s picture

Status: Active » Needs work

hmendes’s picture

Status: Needs review » Needs work
KarimBou’s picture

We're having those dependencies issues on D9.3 aswell after upgrading

matheusmaciel’s picture

Assigned: Unassigned » matheusmaciel

I'll try to work on it!

matheusmaciel’s picture

Assigned: matheusmaciel » Unassigned

I'll no longer be able to work on this issue.

andregp’s picture

Assigned: Unassigned » andregp

I'm working to find out why the test PasswordExpiredEmailSendTest is failing and try to fix it.
I'm also going to rebase the MR to resolve the current unmergeable state.

andregp’s picture

Assigned: andregp » Unassigned
Status: Needs work » Needs review

I finally managed to fix the failing test (with help from @paulocs) and rebased the MR to make it up to date.
The problem on the failing test was that some elements were added to the PasswordPolicy edit form in the main branch, but were removed on the previous reroll so I had to add it back to the form.

bkendally’s picture

Assigned: Unassigned » bkendally

I can review.

bkendally’s picture

Assigned: bkendally » Unassigned
WagnerMelo’s picture

Assigned: Unassigned » WagnerMelo

Hi, i'll try review it. XD

WagnerMelo’s picture

Assigned: WagnerMelo » Unassigned

Hi, i tried made this review, but i found a bug in the module.
I couldn't be able to test the functionality of module, because when i tried create a new password constraint, the site never save the new constraint. When i clicked on save button, only refresh but don't save, it only was able to save new constraints when i applied the patch sended by @paulocs. That created a new module to remove the dependecy on ctools, and talk with him about this review.
He asked me to try use the module without his patch, creating news constraints, and after that apply the patch to see how this new sub-module works, beacuse one of functionalitys was make a backup of the existents constraints, beacuse if don't had this functionality, who already use the module went lose yours existents constraints.
So, because that, i coudn't made the review this issue, cause i could not test the module.

ps: i don't know exactly if i need change this issue to need work, so i'll let how are.

elber’s picture

Assigned: Unassigned » elber
elber’s picture

elber’s picture

Assigned: elber » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi I was able to apply the André's MR and with it the module is working normally.

I was able to create a new policy for my passwords.

The module now doesn't need the ctools module (this dependencies were removed correctly).

sergiur’s picture

elber’s picture

Assigned: Unassigned » elber
Status: Reviewed & tested by the community » Needs work

sorry I forget to review it.

elber’s picture

Assigned: elber » Unassigned
Status: Needs work » Needs review

Hi I just made the change that @segiour mentioned.

lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

Assigned: lucassc » Unassigned

Hi!

I removed remaining references to ctools. With this I believe the tests will pass too.

Please, review this.

elber’s picture

Assigned: Unassigned » elber
elber’s picture

Assigned: elber » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi I was able to apply the @lucasssc's changes.

I added all the policies possible after that I create a new password for my user and I verified that all policies are working good.

I didn't find the ctools dependency on this module.

kim.pepper’s picture

This issue splits out a new module password_policy_ui and does a whole lot of other seemingly unrelated code changes. The issue summary needs an update with all the changes, including UI changes (screenshots?) to make it easier to review.

paulocs’s picture

Assigned: Unassigned » paulocs
Status: Reviewed & tested by the community » Needs work

I think we should focus first on remove the ctools dependency. Thank we can create the password_policy_ui if it's necessary. I'll work on it.

paulocs’s picture

Assigned: paulocs » Unassigned
Issue summary: View changes
Issue tags: -Needs issue summary update

Just created MR 37. It is not ready yet. I have to do more manual tests and clean the code, so leaving in NW for now. I have unassigned my self if someone wants to work on it during the weekend.

Anyway next week I'll work more on this issue :)

paulocs’s picture

Status: Needs work » Needs review

Please review it :)

lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

I applied the MR !37 locally to 9.4.x and it worked for me, so I checked the Issue summary and verified that:

1) Remove ctools depedency
Done! ctools depedency was completely removed.

2) Attach screenshots from the changes.
Done, ScreenShots (SS) attached:
- files with 'MR-37' prefix are SS from source branch;
- files with '8.x-3.x' prefix are SS from target branch;
- files with 'add' in name are SS from the new form to create Password Policy;
- files with 'edit' in name are SS from the new form to edit Password Policy.

3) Check if the new form to create/edit the Password Policy is user-friendly.
It's my first time using the module and the new form to create/edit Password Policy, IMHO is super user-friendly!

Also, I found a few coding standards problems and fixed it.

Please, review this.

  • paulocs committed 10b06ad on 8.x-3.x
    Issue #2877040 by hmendes, hswong3i, lucassc, andregp, elber: Remove...
paulocs’s picture

Status: Needs review » Fixed
paulocs’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.