Closed (fixed)
Project:
Password Policy
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
15 May 2014 at 19:13 UTC
Updated:
18 Jun 2014 at 04:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jrglasgow commentedIt appears to me that the username constraint plugin is malformed so it doesn't know which field to save.
This patch worked for me.
Comment #3
jrglasgow commentedupdated the patch to put back a few things that were accidentally omitted
Comment #4
jrglasgow commentedComment #5
aohrvetpv commentedReviewed and looks good. Username constraint checkbox value was not getting saved because
PasswordPolicyItem::admin_form_submit()expects the form element machine name ('username') to match the constraint config ID (was 'enabled', now 'username').Applied patch and confirmed username constraint working.
Two additional comments:
1. Perhaps there should be SimpleTest functional tests that test enabling constraints as a user would do.
2. 'prime value' seems like an ambiguous name. Not clear to me what its purpose is. Best I can tell it is a machine name for the constraint, which allows a different name from the base filename of the constraint. Perhaps 'item name' or 'name' or something would be clearer? Or an explanatory comment?
Comment #6
erikwebb commented@AohRveTPV - Since we are changing the name of the config ID, do we need an update function to change the values of existing policies?
Comment #7
aohrvetpv commentedIf I understand your question correctly: There might be an unused 'enabled' element left in
$configafter applying this patch if the user had previously attempted to enable the username constraint. If so, it would probably be best to have an update function that removes that unused element. I will try to check.Comment #8
aohrvetpv commentedHere's a patch that adds update code. I dislike the code though because I think it is operating at the wrong level of abstraction. I think a PasswordPolicy object ought to have a save method, abstracting away the details of how it gets saved. Code like the following would seem more elegant:
Maybe there is already a way to do it like that, skipping the direct ctools calls, and I am not aware.
Comment #9
erikwebb commented@AohRveTPV - I agree. Let's fix this issue and open a new one to refactor that method.
Comment #10
aohrvetpv commentedSounds good. Patch in #8 adding update code is ready for review and/or commit.
Comment #11
aohrvetpv commentedFound a minor coding standards problem in patch. Will post new one soon.
Comment #12
aohrvetpv commentedChanged update function comment to the imperative per documentation standards.
Comment #13
deekayen commented