comparison modules/user/user.module @ 7:fff6d4c8c043 6.3

Drupal 6.3
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:30:28 +0100
parents 2427550111ae
children acef7ccb09b5
comparison
equal deleted inserted replaced
6:2cfdc3c92142 7:fff6d4c8c043
1 <?php 1 <?php
2 // $Id: user.module,v 1.892.2.2 2008/04/09 21:11:51 goba Exp $ 2 // $Id: user.module,v 1.892.2.5 2008/07/09 21:48:28 goba Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Enables the user registration and login system. 6 * Enables the user registration and login system.
7 */ 7 */
662 $form['submit'] = array('#type' => 'submit', 662 $form['submit'] = array('#type' => 'submit',
663 '#value' => t('Log in'), 663 '#value' => t('Log in'),
664 ); 664 );
665 $items = array(); 665 $items = array();
666 if (variable_get('user_register', 1)) { 666 if (variable_get('user_register', 1)) {
667 $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.'))); 667 $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
668 } 668 }
669 $items[] = l(t('Request new password'), 'user/password', array('title' => t('Request new password via e-mail.'))); 669 $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
670 $form['links'] = array('#value' => theme('item_list', $items)); 670 $form['links'] = array('#value' => theme('item_list', $items));
671 return $form; 671 return $form;
672 } 672 }
673 673
674 /** 674 /**
1264 } 1264 }
1265 1265
1266 /** 1266 /**
1267 * Set up a series for validators which check for blocked/denied users, 1267 * Set up a series for validators which check for blocked/denied users,
1268 * then authenticate against local database, then return an error if 1268 * then authenticate against local database, then return an error if
1269 * authentication fails. Distributed authentication modules are welcome 1269 * authentication fails. Distributed authentication modules are welcome
1270 * to use hook_form_alter() to change this series in order to 1270 * to use hook_form_alter() to change this series in order to
1271 * authenticate against their user database instead of the local users 1271 * authenticate against their user database instead of the local users
1272 * table. 1272 * table.
1273 * 1273 *
1274 * We use three validators instead of one since external authentication 1274 * We use three validators instead of one since external authentication
1275 * modules usually only need to alter the second validator. 1275 * modules usually only need to alter the second validator.
1276 * 1276 *
1357 watchdog('user', 'Session opened for %name.', array('%name' => $user->name)); 1357 watchdog('user', 'Session opened for %name.', array('%name' => $user->name));
1358 // Update the user table timestamp noting user has logged in. 1358 // Update the user table timestamp noting user has logged in.
1359 // This is also used to invalidate one-time login links. 1359 // This is also used to invalidate one-time login links.
1360 $user->login = time(); 1360 $user->login = time();
1361 db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid); 1361 db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid);
1362
1363 // Regenerate the session ID to prevent against session fixation attacks.
1364 sess_regenerate();
1362 user_module_invoke('login', $edit, $user); 1365 user_module_invoke('login', $edit, $user);
1363 sess_regenerate();
1364 } 1366 }
1365 1367
1366 /** 1368 /**
1367 * Submit handler for the login form. Redirects the user to a page. 1369 * Submit handler for the login form. Redirects the user to a page.
1368 * 1370 *
1634 case 'register_admin_created_subject': 1636 case 'register_admin_created_subject':
1635 return t('An administrator created an account for you at !site', $variables, $langcode); 1637 return t('An administrator created an account for you at !site', $variables, $langcode);
1636 case 'register_admin_created_body': 1638 case 'register_admin_created_body':
1637 return t("!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $variables, $langcode); 1639 return t("!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $variables, $langcode);
1638 case 'register_pending_approval_subject': 1640 case 'register_pending_approval_subject':
1639 case 'pending_approval_admin_subject': 1641 case 'register_pending_approval_admin_subject':
1640 return t('Account details for !username at !site (pending admin approval)', $variables, $langcode); 1642 return t('Account details for !username at !site (pending admin approval)', $variables, $langcode);
1641 case 'register_pending_approval_body': 1643 case 'register_pending_approval_body':
1642 return t("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- !site team", $variables, $langcode); 1644 return t("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- !site team", $variables, $langcode);
1643 case 'register_pending_approval_admin_body': 1645 case 'register_pending_approval_admin_body':
1644 return t("!username has applied for an account.\n\n!edit_uri", $variables, $langcode); 1646 return t("!username has applied for an account.\n\n!edit_uri", $variables, $langcode);