/[drupal]/contributions/modules/phpass/phpass.module
ViewVC logotype

Diff of /contributions/modules/phpass/phpass.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.9, Fri Jun 27 14:59:39 2008 UTC revision 1.1.2.10, Fri Jul 25 15:56:57 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: phpass.module,v 1.1.2.8 2008/06/24 04:12:01 douggreen Exp $  // $Id: phpass.module,v 1.1.2.9 2008/06/27 14:59:39 douggreen Exp $
3    
4  /**  /**
5   * phpass Module   * phpass Module
# Line 27  function phpass_form_alter($form_id, &$f Line 27  function phpass_form_alter($form_id, &$f
27    
28    // hook the change password form    // hook the change password form
29    switch ($form_id) {    switch ($form_id) {
     case 'user_edit':  
       $form['#submit']['phpass_edit_submit'] = array();  
       break;  
   
30      case 'system_modules':      case 'system_modules':
31        // don't allow the user to uninstall this module        // don't allow the user to uninstall this module
32        if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE pass = 'phpass'"))) {        if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE pass = 'phpass'"))) {
# Line 97  function phpass_form_alter($form_id, &$f Line 93  function phpass_form_alter($form_id, &$f
93  }  }
94    
95  /**  /**
96     * Implement hook_user to save the hash password.
97     */
98    function phpass_user($op, &$edit, &$account, $category = NULL) {
99      switch ($op) {
100        case 'submit':
101          _phpass_save($account->uid, $edit['pass']);
102          unset($edit['pass']);
103          break;
104      }
105    }
106    
107    /**
108   * This is a copy of user_login_validate, that calls our validate   * This is a copy of user_login_validate, that calls our validate
109   * instead of the default user validation.   * instead of the default user validation.
110   *   *
# Line 192  function _phpass_load(&$user) { Line 200  function _phpass_load(&$user) {
200    user_module_invoke('load', $array, $user);    user_module_invoke('load', $array, $user);
201  }  }
202    
 /**  
  * Save the password  
  */  
 function phpass_edit_submit($form_id, &$form_values) {  
   if (variable_get('user_hash_method', 'phpass') == 'phpass') {  
     global $user;  
     _phpass_save($user->uid, $form_values['pass']);  
   }  
 }  
   
203  function _phpass_save($uid, $pass) {  function _phpass_save($uid, $pass) {
204    // initialize phpass    // initialize phpass
205    require_once(drupal_get_path('module', 'phpass') .'/PasswordHash.php');    require_once(drupal_get_path('module', 'phpass') .'/PasswordHash.php');

Legend:
Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10

  ViewVC Help
Powered by ViewVC 1.1.2