Show
Ignore:
Timestamp:
04/01/05 16:38:25 (8 years ago)
Author:
fproulx
Message:

2005-04-01 Francois Proulx <francois.proulx@…>

  • EVERYTHING IS NOW UTF-8 YOU MUST EDIT YOUR FILES WITH AN UTF-8 COMPLIANT EDITOR
  • The database will be converted to UTF-8 (version 5)
  • Added select boxes ( or hidden ) html form elements to choose the network for signup, lost password, username
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/lost_password.php

    r517 r530  
    2222  /**@file 
    2323   * Login page 
    24    * @author Copyright (C) 2004 Benoit Grgoire et Philippe April 
     24   * @author Copyright (C) 2004 Benoit Grégoire et Philippe April 
    2525   */ 
    2626define('BASEPATH','./'); 
     
    3535        $username = $db->EscapeString($_REQUEST['username']); 
    3636        $email = $db->EscapeString($_REQUEST['email']); 
     37        // If the source is present and that it's in our AUTH_SOURCE_ARRAY, save it to a var for later use 
     38                $_REQUEST['auth_source'] && in_array($_REQUEST['auth_source'], array_keys($AUTH_SOURCE_ARRAY)) && $account_origin = $_REQUEST['auth_source']; 
    3739 
    3840        try { 
     41                if(empty($account_origin)) 
     42                                throw new Exception(_("Sorry, this network does not exist !")); 
     43                                 
    3944                // Get a list of users associated with either a username of an e-mail 
    40             $username && $users_list = User::getUsersByUsername($username); 
    41             $email && $users_list = User::getUsersByEmail($email); 
     45            $username && $user = User::getUserByUsernameAndOrigin($username, $account_origin); 
     46            $email && $user = User::getUserByEmailAndOrigin($email, $account_origin); 
    4247             
    4348            // In the case that both previous function calls failed to return a users list 
    4449            // Throw an exception 
    45             if(!empty($users_list)) 
    46                     foreach($users_list as $user) 
    47                         $user->sendLostPasswordEmail(); 
     50            if($user != null) 
     51                    $user->sendLostPasswordEmail(); 
    4852                else 
    49                         throw new Exception(_("user_id '{$object_id_str}' could not be found in the database")); 
     53                        throw new Exception(_("This username or email could not be found in our database")); 
    5054                 
    5155            $smarty->assign('message', _('A new password has been emailed to you.')); 
     
    5862} 
    5963 
     64// Add the auth servers list to smarty variables 
     65$sources = array (); 
     66// Preserve keys 
     67foreach (array_keys($AUTH_SOURCE_ARRAY) as $auth_source_key) 
     68        if ($AUTH_SOURCE_ARRAY[$auth_source_key]['authenticator']->isRegistrationPermitted()) 
     69                $sources[$auth_source_key] = $AUTH_SOURCE_ARRAY[$auth_source_key]; 
     70 
     71isset ($sources) && $smarty->assign('auth_sources', $sources); 
     72// Pass the account_origin along, if it's set 
     73isset ($_REQUEST["auth_source"]) && $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); 
     74 
    6075$smarty->display("templates/lost_password.html"); 
    6176?>