Changeset 25104


Ignore:
Timestamp:
10/24/13 00:01:51 (6 years ago)
Author:
Eric
Message:

Next version is 2.5.1 :

  • Improve workflow when account is locked and a password renewal is set
  • Add missing translation keys
  • Update it_IT, thanks to : Ericnet
Location:
extensions/Password_Policy
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/Password_Policy/changelog.txt.php

    r25028 r25104  
    55 
    66-- 2.5.0 : Initial release for Piwigo 2.5 
     7 
     8-- 2.5.1 : Improve workflow when account is locked and a password renewal is set 
     9           Missing translation keys 
     10           Update it_IT, thanks to : Ericnet 
    711*/ 
    812?> 
  • extensions/Password_Policy/include/functions.inc.php

    r25089 r25104  
    3030 * Triggered on loc_begin_index 
    3131 *  
    32  * Initiating GhostTracker - Perform user logout after registration if account locked 
     32 * Perform user logout after registration if account locked and redirection to profile page is password renewal is set 
    3333 */ 
    3434function PP_Init() 
     
    4040  $conf_PP = unserialize($conf['PasswordPolicy']); 
    4141 
    42   // Admins, Guests and Adult_Content users are excluded 
    43   // --------------------------------------------------- 
    44   if (!is_admin() and !is_a_guest() and $user['username'] != "16" and $user['username'] != "18") 
     42  // Perfoming redirection for locked accounts 
     43  // ----------------------------------------- 
     44  if (!is_a_guest() and $user['username'] != "16" and $user['username'] != "18") 
    4545  { 
    4646    // Perform user logout if user account is locked 
    4747    if ( 
    48         (isset($conf_PP['LOGFAILBLOCK']) and $conf_PP['LOGFAILBLOCK'] == 'true') 
    49         and PP_UsrBlock_Verif($user['username']) 
    50         and !is_admin() 
    51         and !is_webmaster() 
    52         ) 
     48          (isset($conf_PP['LOGFAILBLOCK']) and $conf_PP['LOGFAILBLOCK'] == 'true') 
     49          and PP_UsrBlock_Verif($user['username']) 
     50          //and (isset($userlocked) and $userlocked == 'true') 
     51          and !is_admin() 
     52          and !is_webmaster()) 
    5353    { 
    5454      invalidate_user_cache(); 
     
    6464    } 
    6565  } 
     66 
     67  // Performing redirection to profile page for password reset 
     68  // --------------------------------------------------------- 
     69  if ((isset($conf_PP['PWDRESET']) and $conf_PP['PWDRESET'] == 'true')) 
     70  { 
     71    $query =' 
     72SELECT user_id, status 
     73FROM '.USER_INFOS_TABLE.' 
     74WHERE user_id = '.$user['id'].' 
     75;'; 
     76    $data = pwg_db_fetch_assoc(pwg_query($query)); 
     77 
     78    if ($data['status'] <> "webmaster" and $data['status'] <> "generic") // Exclusion of specific accounts 
     79    { 
     80      if (PP_check_pwdreset($user['id'])) 
     81      { 
     82        redirect(PHPWG_ROOT_PATH.'profile.php'); 
     83      } 
     84    } 
     85  } 
     86 
     87 
    6688} 
    6789 
     
    219241/** 
    220242 * PP_user_list_locked 
    221  * Adds a new feature in user_list to allow password reset for selected users by admin 
     243 * Adds a new feature in user_list to allow user unlocking by admin 
    222244 *  
    223245 */ 
     
    266288  } 
    267289  return $visible_user_list; 
    268 } 
    269  
    270  
    271 /** 
    272  * Triggered on login_success 
    273  *  
    274  * Redirects a visitor (except for admins, webmasters and generic statuses) to his profile.php page if password reset is needed 
    275  *  
    276  */ 
    277 function PP_LoginTasks() 
    278 { 
    279   global $conf, $user; 
    280  
    281   include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 
    282  
    283   $conf_PP = unserialize($conf['PasswordPolicy']); 
    284  
    285   // Perfoming redirection for locked accounts 
    286   // ----------------------------------------- 
    287   if (!is_admin() and !is_a_guest() and $user['username'] != "16" and $user['username'] != "18") 
    288   { 
    289     // Perform user logout if user account is locked 
    290     if ((isset($conf_PP['LOGFAILBLOCK']) and $conf_PP['LOGFAILBLOCK'] == 'true') 
    291           and PP_UsrBlock_Verif($user['username']) 
    292           and !is_admin() 
    293           and !is_webmaster()) 
    294     { 
    295       invalidate_user_cache(); 
    296       logout_user(); 
    297       if ($conf['guest_access']) 
    298       { 
    299         redirect(make_index_url().'?PP_msg=locked', 0); 
    300       } 
    301       else 
    302       { 
    303         redirect(get_root_url().'identification.php?PP_msg=locked' , 0); 
    304       } 
    305     } 
    306   } 
    307  
    308   // Performing redirection to profile page for password reset 
    309   // --------------------------------------------------------- 
    310   if ((isset($conf_PP['PWDRESET']) and $conf_PP['PWDRESET'] == 'true')) 
    311   { 
    312     $query =' 
    313 SELECT user_id, status 
    314 FROM '.USER_INFOS_TABLE.' 
    315 WHERE user_id = '.$user['id'].' 
    316 ;'; 
    317     $data = pwg_db_fetch_assoc(pwg_query($query)); 
    318  
    319     if ($data['status'] <> "webmaster" and $data['status'] <> "generic") // Exclusion of specific accounts 
    320     { 
    321       if (PP_check_pwdreset($user['id'])) 
    322       { 
    323         redirect(PHPWG_ROOT_PATH.'profile.php'); 
    324       } 
    325     } 
    326   } 
    327290} 
    328291 
  • extensions/Password_Policy/language/en_UK/plugin.lang.php

    r25091 r25104  
    6969$lang['PP_User Locked'] = 'User locked'; 
    7070$lang['PP_You need to confirm unlock'] = 'You must confirm unlocking (check box)!'; 
     71$lang['PP %d user unlocked'] = '%d user unlocked'; 
     72$lang['PP %d users unlocked'] = '%d users unlocked'; 
    7173?> 
  • extensions/Password_Policy/language/fr_FR/plugin.lang.php

    r25091 r25104  
    5757$lang['PP_UserLocked_Custom_Txt'] = 'Personnalisation du message d\'information à l\'utilisateur verrouillé'; 
    5858$lang['PP_UserLocked_Custom_Txt_d'] = 'Vous pouvez modifier ici le texte du message affiché à l\'utilisateur dont le compte est verrouillé. Pour une utilisation multi-langues, vous pouvez utiliser les balises [lang] du plugin Extended Description si celui-ci est actif.'; 
    59 $lang['PP_LockedUsers'] = 'Verrouillages'; 
     59$lang['PP_LockedUsers'] = 'Verrous'; 
    6060$lang['PP_Unlock'] = 'Déverrouillage'; 
    6161$lang['PP_Unlock selected users'] = 'Déverrouiller les utilisateurs sélectionnés'; 
     
    6969$lang['PP_User Locked'] = 'Utilisateur verrouillé'; 
    7070$lang['PP_You need to confirm unlock'] = 'Vous devez confirmer le déverrouillage (case à cocher) !'; 
     71$lang['PP %d user unlocked'] = '%d utilisateur déverrouillé'; 
     72$lang['PP %d users unlocked'] = '%d utilisateurs déverrouillés'; 
    7173?> 
  • extensions/Password_Policy/main.inc.php

    r25090 r25104  
    2727add_event_handler('get_admin_plugin_menu_links', 'PP_admin_menu'); 
    2828 
     29// Display messages on index page 
     30// ------------------------------ 
     31add_event_handler('init', 'PP_InitPage'); 
     32 
    2933// Features and controls on user connexion 
    3034// --------------------------------------- 
    3135add_event_handler('loc_begin_index', 'PP_Init'); 
    32  
    33 // Display messages on index page 
    34 // ------------------------------ 
    35 add_event_handler('init', 'PP_InitPage'); 
    3636 
    3737// Check users registration 
     
    4343  add_event_handler('loc_begin_profile', 'PP_Profile_Init'); 
    4444} 
    45  
    46 // Redirection to profile page 
    47 // --------------------------- 
    48 add_event_handler('login_success', 'PP_LoginTasks',EVENT_HANDLER_PRIORITY_NEUTRAL+10, 1); 
    4945 
    5046// Security option : Count of login failure and lock account after x attempt 
Note: See TracChangeset for help on using the changeset viewer.