[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> lost_pwd.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: lost_pwd.php,v 1.7.2.1 2007-10-13 22:33:21 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      # ======================================================================
  25      # Author: Marcello Scata' <marcelloscata at users.sourceforge.net> ITALY
  26      # ======================================================================
  27  
  28      require_once ( 'core.php' );
  29  
  30      # lost password feature disabled or reset password via email disabled -> stop here!
  31      if( OFF == config_get( 'lost_password_feature' ) ||
  32          OFF == config_get( 'send_reset_password' ) ||
  33          OFF == config_get( 'enable_email_notification' ) ) {
  34          trigger_error( ERROR_LOST_PASSWORD_NOT_ENABLED, ERROR );
  35      }
  36  
  37      # force logout on the current user if already authenticated
  38      if( auth_is_user_authenticated() ) {
  39          auth_logout();
  40      }
  41  
  42      $f_username = gpc_get_string('username');
  43      $f_email = gpc_get_string('email');
  44  
  45      $f_email = email_append_domain( $f_email );
  46      email_ensure_valid( $f_email );
  47  
  48      $c_username = db_prepare_string( $f_username );
  49      $c_email = db_prepare_string( $f_email );
  50  
  51      $t_user_table = config_get( 'mantis_user_table' );
  52  
  53      # @@@ Consider moving this query to user_api.php
  54      $query = 'SELECT id FROM ' . $t_user_table . ' WHERE username = \'' . $c_username . '\' AND email = \'' . $c_email . '\' AND enabled=1';
  55      $result = db_query( $query );
  56  
  57      if ( 0 == db_num_rows( $result ) ) {
  58          trigger_error( ERROR_LOST_PASSWORD_NOT_MATCHING_DATA, ERROR );
  59      }
  60  
  61      if( is_blank( $f_email ) ) {
  62          trigger_error( ERROR_LOST_PASSWORD_NO_EMAIL_SPECIFIED, ERROR );
  63      }
  64  
  65      $row = db_fetch_array( $result );
  66      $t_user_id = $row['id'];
  67  
  68      if( user_is_protected( $t_user_id ) ) {
  69          trigger_error( ERROR_PROTECTED_ACCOUNT, ERROR );
  70      }
  71  
  72      if( !user_is_lost_password_request_allowed( $t_user_id ) ) {
  73          trigger_error( ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED, ERROR );
  74      }
  75  
  76      $t_confirm_hash = auth_generate_confirm_hash( $t_user_id );
  77      email_send_confirm_hash_url( $t_user_id, $t_confirm_hash );
  78  
  79      user_increment_lost_password_in_progress_count( $t_user_id );
  80  
  81      $t_redirect_url = 'login_page.php';
  82  
  83      html_page_top1();
  84      html_page_top2();
  85  ?>
  86  
  87  <br />
  88  <div align="center">
  89  <table class="width50" cellspacing="1">
  90  <tr>
  91      <td class="center">
  92          <b><?php echo lang_get( 'lost_password_done_title' ) ?></b>
  93      </td>
  94  </tr>
  95  <tr>
  96      <td>
  97          <br/>
  98          <?php echo lang_get( 'reset_request_in_progress_msg' ) ?>
  99          <br/><br/>
 100      </td>
 101  </tr>
 102  </table>
 103  <br />
 104  <?php print_bracket_link( 'login_page.php', lang_get( 'proceed' ) ); ?>
 105  </div>
 106  
 107  <?php html_page_bottom1a( __FILE__ ) ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics