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

Comments

erikwebb’s picture

Do you think that we should make it a required field or just default it to 0?

ladybug_3777’s picture

I 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.

erikwebb’s picture

Title: Hard SQL Error » Validate expiration field
Status: Active » Needs review
StatusFileSize
new1.42 KB
erikwebb’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.