| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* The nocase module allows for case insensitive Drupal passwords.
|
| 7 |
*
|
| 8 |
* @author Karthik Kumar ( http://drupal.org/user/21209 )
|
| 9 |
*/
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_form_alter.
|
| 13 |
*/
|
| 14 |
function nocase_form_alter($form_id, &$form) {
|
| 15 |
if ($form['#base'] == 'user_login' || $form_id == 'user_register') {
|
| 16 |
// Give nocase module's validate function preference over user_login.
|
| 17 |
$form['#validate'] = array('nocase_login_validate' => array()) + $form['#validate'];
|
| 18 |
}
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Validation handler for the user_login and user_register forms.
|
| 23 |
*/
|
| 24 |
function nocase_login_validate($form_id, $form_values) {
|
| 25 |
// Convert password to lowercase.
|
| 26 |
form_set_value(array('#parents' => array('pass')), strtolower(trim($form_values['pass'])));
|
| 27 |
}
|