Changeset 32 for trunk/preferences


Ignore:
Timestamp:
06/08/07 15:18:19 (17 years ago)
Author:
niltonneto
Message:

* empty log message *

Location:
trunk/preferences
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/preferences/changepassword.php

    r2 r32  
    2020        include('../header.inc.php'); 
    2121 
     22        $a_passwd   = $_POST['a_passwd']; 
    2223        $n_passwd   = $_POST['n_passwd']; 
    2324        $n_passwd_2 = $_POST['n_passwd_2']; 
     
    3233                'form' => 'changepassword.tpl' 
    3334        )); 
     35        $GLOBALS['phpgw']->template->set_var('lang_enter_actual_password',lang('Enter your actual password')); 
    3436        $GLOBALS['phpgw']->template->set_var('lang_enter_password',lang('Enter your new password')); 
    3537        $GLOBALS['phpgw']->template->set_var('lang_reenter_password',lang('Re-enter your password')); 
     
    4648        if ($_POST['change']) 
    4749        { 
     50                if (! $GLOBALS['phpgw']->auth->authenticate($GLOBALS['phpgw_info']['user']['account_lid'], $a_passwd)) 
     51                { 
     52                        $errors[] = lang('Your actual password is wrong'); 
     53                } 
     54 
    4855                if ($n_passwd != $n_passwd_2) 
    4956                { 
     
    5562                        $errors[] = lang('You must enter a password'); 
    5663                } 
     64                 
     65                // Default number of letters = 3 
     66                if (!$GLOBALS['phpgw_info']['server']['num_letters_userpass']) 
     67                        $GLOBALS['phpgw_info']['server']['num_letters_userpass'] = 3; 
     68                // Default number of special letters = 0 
     69                if (!$GLOBALS['phpgw_info']['server']['num_special_letters_userpass']) 
     70                        $GLOBALS['phpgw_info']['server']['num_special_letters_userpass'] = 0; 
    5771 
     72                if ( strlen( $n_passwd ) < $GLOBALS['phpgw_info']['server']['num_letters_userpass'] ) 
     73                { 
     74                        $errors[] = lang('Your password must contain %1 or more letters', $GLOBALS['phpgw_info']['server']['num_letters_userpass']); 
     75                } 
     76                 
     77                # password that start with a-Z or 0-9 and contain _.-!@#$%&*+=| will be accepted. 
     78                if (! ereg ("^([-a-zA-Z0-9_.\-!@#$%&*+=|])*$", $n_passwd ) ) 
     79                { 
     80                        $errors[] = lang('Your password contains characters not allowed'); 
     81                } 
     82                 
     83                # password must contain 2 special letters, numbers or special characters 
     84                if (! ereg ("([0-9_.\-!@#$%&*+=|]){".$GLOBALS['phpgw_info']['server']['num_special_letters_userpass'].",}", $n_passwd ) ) 
     85                { 
     86                        $errors[] = lang('Your password must contain at least %1 numbers or characters special', $GLOBALS['phpgw_info']['server']['num_special_letters_userpass']); 
     87                } 
     88                 
    5889                if(is_array($errors)) 
    5990                { 
  • trunk/preferences/templates/default/changepassword.tpl

    r2 r32  
    55   <form method="POST" action="{form_action}"> 
    66    <table border="0"> 
     7     <tr> 
     8       <td> 
     9        {lang_enter_actual_password} 
     10       </td> 
     11       <td> 
     12        <input type="password" name="a_passwd"> 
     13       </td> 
     14     </tr> 
    715     <tr> 
    816       <td> 
Note: See TracChangeset for help on using the changeset viewer.