"Your Password has expired please change it now" is an ok default message. But this should be configurable.

Comments

mrfelton’s picture

Status: Active » Needs review
StatusFileSize
new1.99 KB
erikwebb’s picture

Status: Needs review » Needs work

This creates the possible case that no message would be shown at all. Being somewhat newer to CTools APIs, when would the message ever be empty? I'd like to always make sure it's at least showing the default message.

mrfelton’s picture

Status: Needs work » Needs review

I have a use case for having the message empty. We are using the new 'force first' plugin in order to force users of certain roles to change their password the first time they log in. Our intent is to do this by redirecting them to a page where we show only the password form, and within the content of the page there will be a description/help text asking them to set their password. In this case, there is no need to show a warning message as that information is conveyed in the page. Currently, we dont have that aspect working as we still need to build that password change only page, but once that is working, there will be no need for a warning message at all. The patch I submitted still has the default message, but also allows the user to override this, including setting it to be blank. This kind of flexibility is important, as we can't predict everyones use cases for expiring passwords.

/**
 * Implements hook_default_password_policy().
 */
function alumni_profile_default_password_policy() {
  $export = array();

  $password_policy = new stdClass();
  $password_policy->disabled = FALSE; /* Edit this to true to make a default password_policy disabled initially */
  $password_policy->api_version = 1;
  $password_policy->name = 'alumni_profile_force_password';
  $password_policy->config = 'a:11:{s:11:"alpha_count";a:1:{s:11:"alpha_count";s:0:"";}s:10:"char_count";a:1:{s:10:"char_count";s:1:"6";}s:11:"consecutive";a:1:{s:22:"consecutive_char_count";s:0:"";}s:9:"int_count";a:1:{s:9:"int_count";s:0:"";}s:14:"past_passwords";a:1:{s:14:"past_passwords";s:0:"";}s:12:"symbol_count";a:2:{s:12:"symbol_count";s:0:"";s:20:"symbol_count_symbols";s:30:"!@#$%^&*()_+=-|}{"?:><,./;\'\\[]";}s:8:"username";a:1:{s:7:"enabled";b:0;}s:4:"role";a:1:{s:5:"roles";a:9:{i:91284557;s:8:"91284557";i:10051403;s:8:"10051403";i:2;i:0;i:6571740;i:0;i:266198706;i:0;i:256385100;i:0;i:165551708;i:0;i:188360144;i:0;i:169059283;i:0;}}s:6:"expire";a:5:{s:12:"expire_limit";s:9:"-1 second";s:25:"expire_warning_email_sent";s:0:"";s:28:"expire_warning_email_message";s:0:"";s:28:"expire_warning_email_subject";s:92:"[user:name] you password on [site:name] shall expire in [password_expiration_date:interval] ";s:22:"expire_warning_message";s:96:"For security purposes, please select your own personal password to begin enjoying your benefits.";}s:5:"force";a:2:{s:19:"force_first_enabled";i:0;s:15:"force_first_url";s:0:"";}s:5:"first";a:1:{s:13:"first_enabled";i:1;}}';
  $export['alumni_profile_force_password'] = $password_policy;

  return $export;
}
projects[password_policy][subdir] = contrib
projects[password_policy][download][type] = git
projects[password_policy][download][url] = http://git.drupal.org/project/password_policy.git
projects[password_policy][download][branch] = 7.x-2.x
projects[password_policy][download][revision] = b0af4c7d01b05347ed95a83e775a906a4732869d
projects[password_policy][patch][] = http://drupal.org/files/password_policy-do_not_run_disabled_policies-1923794-5.patch
projects[password_policy][patch][] = http://drupal.org/files/1924032-password_policy-expire-no-notify.patch
projects[password_policy][patch][] = http://drupal.org/files/1923990-password_policy-condition-AND.patch
projects[password_policy][patch][] = http://drupal.org/files/1920614.10-password-policy-force-login.patch
projects[password_policy][patch][] = http://drupal.org/files/1924118.4-password_policy-user-validate.patch
projects[password_policy][patch][] = http://drupal.org/files/1924138-password_policy-message-config.patch
erikwebb’s picture

Status: Needs review » Fixed

You're right. I've altered the patch a little bit to bold the case if the message is empty, just to alert people to that special case.

http://drupalcode.org/project/password_policy.git/commit/220a148

Please consider helping out with the Password tab module now that there is some code in the repo.

Status: Fixed » Closed (fixed)

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