Closed (fixed)
Project:
Password Policy
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 May 2015 at 18:27 UTC
Updated:
25 Jan 2016 at 07:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
aohrvetpv commentedDoes this change fix the problem?
Comment #2
oturpin commentedHi AohRveTPV,
So quick !!! Much better. Pb solved.
Thx
Comment #3
aohrvetpv commentedOK, great. I will plan to develop a better fix for commit.
The code was always trying to customize the password field for the
user_register_formanduser_profile_form, whether or not the password field existed on them.Comment #4
aohrvetpv commentedSame fix, but try to make code intent more explicit.
Comment #5
oturpin commentedHi AohRveTPV,
Don't know if any link with database type... I am using Postgresql. Fix is OK for me.
Thx
Comment #7
aohrvetpv commentedComment #8
sgdev commentedThis same problem exists with the Profile2 module. Looking at the patch, I'm wondering if there's a simpler way that it could be done, without hard coding
user_profile_formanduser_register_formin the code?How about just setting the default array value to
NULL, and skipping the function if no array is set. Seems more straightforward to me, unless I'm missing some particular case?:Comment #9
sgdev commentedLooking a little more closely at the patch you created in #1, it's relatively close to what I added, except you're using a
returnto break out of the function.I'm assuming the reason for the more lengthy approach in #4 is you're wanting to be more explicit in the solution?
Comment #10
aohrvetpv commentedThat would be ideal. I thought there could possibly be cases where
$form['account']['pass']is set but the element should not be altered. (The original authors may have hard-coded the form IDs for a reason.) So adding an extra condition seemed safest initially.I'm not sure your proposed code change would work though. Have you tried it? On some forms, I believe
$form['account']will not be set, so accessing$form['account']['pass']in the call topassword_policy_password_element_alter()would give an error.Comment #11
aohrvetpv commentedYes, I wanted the purpose of the conditionals to be clearer. A problem I have had working with the code, especially the 1.x branch, is conditionals where it is unclear what they are doing or why they are necessary.
Comment #12
sgdev commentedI did try my suggestion with Profile2 and it worked as I would expect, however as you mentioned it may not work in all situations.
Certainly a case where
$form['account']is not set would be an issue.Comment #14
mudjunky commented+1 for @ron_s #8 solution. The patches did not work for me. They fixed the fatal error, but nullified the password policy. Users could enter any password they wanted without any barrier from the password policy.
Comment #15
aohrvetpv commentedmudjunky, are you also using Profile2?
Comment #16
Anonymous (not verified) commentedYes, with Profile2 I am receiving this error. I'm attaching a patch with the solution from #8, which fixes the problem for me.
H.
Comment #18
Anonymous (not verified) commentedThe patch was made against the dev version, that's why it failed the tests.
Comment #21
badjava commented+1 on the commit in #6. While it may not be the simplest implementation as others have suggested, it does work and should $form['account'] be unset, everything still works well. This issue appears to be resolved.
@mudjunky re: #14 - Try the dev version or use the patch from it which should apply cleanly to alpha5.
Comment #22
aohrvetpv commentedI believe this is fixed in 7.x-2.0-alpha6 and onward, without hard-coding form IDs, by the patch committed in #2562481: Apply password policies to account password elements on custom forms:
http://cgit.drupalcode.org/password_policy/commit/?id=9f69062
If you experienced this error before, please retest with 7.x-2.0-alpha6 or later, and let us know whether it still occurs. If so, we can re-open. Thanks all.