backdrop-ops / contrib

Apply to join the contributed code developer team.
23 stars 16 forks source link

Port Request: Password Policy #763

Open neanhunt opened 6 months ago

neanhunt commented 6 months ago

Name of the module, theme, or layout Password Policy

Link to the drupal.org module, theme, or layout https://www.drupal.org/project/password_policy

I tried to port this module over using the upgrade module and it looked like it worked but when I tried to use it I received the following: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'role' doesn't exist: SELECT r.name AS name FROM {role} r INNER JOIN {password_policy_role} p ON p.rid = r.rid WHERE (p.pid = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 1 )

oadaeh commented 6 months ago

Hello. Are you aware of this module?: https://github.com/backdrop-contrib/passphrase_policy It is a port of the Password Policy by one of the D7 maintainers with some modifications. You might or might not care for the modifications. If you are fine with them, then the Passphrase Policy module might be all you need.

If not, maybe the code of the Passphrase Policy module might have clues on what needs to be done. If it doesn't, provide more information about the error, like the line number and filename that is causing it, and maybe someone can offer a suggestion.

neanhunt commented 6 months ago

The elements we used heavily with Password Policy was settings requirements for the password complexity and setting a requirement that users need to update their password every 90 days. This enforced passwords getting updated and blocked accounts for users that did not make the 90 day requirement. This helped with deactivating unused accounts.

argiepiano commented 6 months ago

@neanhunt, for many D7 modules, running them through the coder_upgrade module is not enough to obtain a working module. In the case you mention, D7 used a table called role to store the role definitions. In Backdrop, this was changed. Role definitions now are stored as a JSON configuration files in your active config folder (typically files/config_XXX/active), for example, user.role.administrator.json for the administrator, etc.

So, you will need to do some tweaking and changes to the module to adapt to those types of differences.

argiepiano commented 6 months ago

Further: I would suggest you put the semi-ported module in your github account. That may help people take a look and suggest changes.

jenlampton commented 6 months ago

@neanhunt I'm also going to need this module for an upcoming project. I'd love to start from the work you've already done, and I have previously adapted modules to go from the D7 role table to the B config alternative. If that's all that's left to do, perhaps we can have this wrapped up quickly :)

neanhunt commented 6 months ago

Sorry @jenlampton for the response delay, I have been dealing with ill (elderly) parents since right after Backdrop Live so I have not been checking on much else. I ran the D7 Password Policy through the Backdrop code_upgrader module and loaded it on my site and saw the DB errors but haven't gone any further. I did load the converted module files here: https://github.com/neanhunt/Password-Policy

jenlampton commented 6 months ago

Beautiful, thank you for sharing that. And no need to apologize, whatever time you have is always appreciated :)