What I read didn't really follow Drupal code standards at all. Coder can help automate the fixes.

Comments

afreeman’s picture

Assigned: Unassigned » afreeman
Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new13.14 KB

The attached patch attempts to address the current issues with this module. The code's been reformated to meet standards, the module now uses it's own table instead of modifying core schema, and there are fixes in place for the admin edit issue and user logout issue.

deekayen’s picture

Status: Needs review » Needs work

Patch doesn't apply. It should be a cvs diff specific to the module directory, not relative to the directories on your machine.

afreeman’s picture

Status: Needs work » Needs review
StatusFileSize
new13.25 KB

Re-rolled patch with tests.

deekayen’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

Patch is still relative to your local filesystem. Please make a cvs diff. http://drupal.org/patch/create

deekayen’s picture

Tests are also missing in patch.

afreeman’s picture

Priority: Normal » Critical
Status: Needs work » Needs review
StatusFileSize
new15.53 KB

Take 2.

deekayen’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

The code you diffed against is not a cvs checkout judging from the block of stuff in .info for version, core, project, and datestamp. Project module adds those lines when it zips up the project and they shouldn't ever be committed back to cvs.

Patch still doesn't pass normal or minor level tests.

  • Implementation of hook_x() is a sentence and should end in a period. The same goes for any of the other sentences in the comment block - start with capital, end with period.
  • No lines should have trailing space.
  • Add // $Id$ to the top of files
  • Add @file blocks
  • Line 63, case 'validate' isn't indented properly.

Why is there HTML in the submit handler for the settings form? I don't like how that's handled. I don't imagine that the role gets xss scrubbed on insert, so the literal output there seems like an open security door. Try making that just a comma delimited list and use % for the t() instead of ! perhaps?

preg_replace is overkill in hook_init(). Try strtr or str_replace instead.

Why are you accessing $_GET['q'] instead of arg() to read logout?

Should hook_init really be hook_boot?

I'm having trouble with the select distinct from user; thing on install and then keeping an entire copy of the users table. Why can't hook_user load, and update handle null returns so that you don't have to keep a row for every user? If a row exists, then they need their password updated, else, your password is fine.

In hook_user, case update, why not just clean the uid out of the table if the load can handle a missing value?

"Do Stuff" is a totally worthless description for the tests.

I wasn't able to run the tests. It errored out on me, but that might just be my local config gone bad. I only see a test of the form. It is missing some tests still.

  • Login as an unprivileged user and assert that you get 403 at the configuration page.
  • Assert that the form elements exist before submitting the form.
  • Create a second user
  • Login as that second user
  • Assert that they are redirected to change their password
  • Try to set the same password again and assert they can't set the same password
  • Set a new password and confirm that it saved
  • Logout the second user, and log back in and assert that they were not redirected to change their password.

Might as well roll in #705068: Add a checkbox on user edit (and add) form to force password change on next login and create tests for it. I didn't see that in this patch, either.

afreeman’s picture

Status: Needs work » Needs review
StatusFileSize
new21.44 KB

Take 3

deekayen’s picture

Status: Needs review » Needs work

I didn't run coder this time, but I don't think if(variable_get('first_time_login_password_change',0)) { spacing would pass either on the if or args. there are similar cases elsewhere

Do Stuff remains, preg_replace remains. Why is the login case commented out in hook_user?

afreeman’s picture

StatusFileSize
new21.2 KB

Take 4

afreeman’s picture

StatusFileSize
new21.2 KB

Fah, missed the preg_replace. Fixed.

afreeman’s picture

Status: Needs work » Needs review
deekayen’s picture

Status: Needs review » Reviewed & tested by the community
deekayen’s picture

Status: Reviewed & tested by the community » Needs work
  • The DSM for "An administrator has required that you change your password. You must change your password to proceed on the site." needs to be $repeat = FALSE.
  • The title and description in hook_menu() don't get t() starting in Drupal 6.
  • When I update my own account, the DSM status returns "will be required to change their password the next time they log in." The front of the sentence is cropped.
  • When I update my own account, change password on next login is checked by default. That seems wrong. If I leave it checked, after changing my password, I'm still required to change my password again, even though I haven't even logged out. This seems to mean that the check is not based on the login event at all, but just a general force password change or else.
  • Updating my own account:
    Notice: Undefined index: name in force_password_change_user_submit() (line 187 of /Users/davidnorman/Sites/alisdair/sites/all/modules/force_password_change/force_password_change.module).
afreeman’s picture

StatusFileSize
new25.24 KB

Thanks for your patience and time. Let's try this again. I've made the changes you mentioned. Additionally I've rewritten the test suite for the module from the ground up to include substantially more robust testing. In response to our conversation about hook_init() vs hook_boot() I ran the current test suite with caching disabled, set to normal, and set to aggressive with none of the tests reporting failure. In light of this I think hook_init() should work fine.

afreeman’s picture

Status: Needs work » Needs review
jaypan’s picture

As I am the sole maintainer of this project, I code it to my own coding standards. Thank you for your suggestions on coding, but I will only be accepting patches for bug fixes. Thank you.

deekayen’s picture

Status: Needs review » Closed (won't fix)

Well then I guess we can't play in your fork and we'll just have to move it back to #292166: force password change on next login, where it should have been in the first place.