Validation should be added to the "Password Expiration" field. If a user leaves this field blank the following error is returned and all settings for the new policy are lost.
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'expiration' at row 1: INSERT INTO {password_policy} (name, description, enabled, policy, expiration, warning) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => Test [:db_insert_placeholder_1] => this will break [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => a:0:{} [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => ) in password_policy_admin_form_submit() (line 444 of C:\inetpub\wwwroot\drupal\sites\all\modules\password_policy\password_policy.admin
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | password_policy-validate_expiration_field-1841858-3.patch | 1.42 KB | erikwebb |
Comments
Comment #1
erikwebb commentedDo you think that we should make it a required field or just default it to 0?
Comment #2
ladybug_3777 commentedI think it should be required and validated to be an integer.
**Edit**
Actually, on second thought, a lot of the other fields are allowed to be blank. So maybe for consistancy it makes more sense to allow a blank value and just default to 0 on the backend.
Comment #3
erikwebb commentedComment #4
erikwebb commentedhttp://drupalcode.org/project/password_policy.git/commit/978be50