| 1 |
<?php |
<?php |
| 2 |
// $Id: webserver_auth.module,v 1.11 2004/11/24 22:03:33 dries Exp $ |
// $Id: webserver_auth.module,v 1.12 2005/04/29 19:27:31 weitzman Exp $ |
| 3 |
|
|
| 4 |
function webserver_auth_init() { |
function webserver_auth_init() { |
| 5 |
global $user, $account; |
global $user, $account; |
| 23 |
$user = user_external_load($account->name); |
$user = user_external_load($account->name); |
| 24 |
if (!$user->uid) { |
if (!$user->uid) { |
| 25 |
if (variable_get("user_register", 1) == 1) { |
if (variable_get("user_register", 1) == 1) { |
| 26 |
$user_default = array("name" => $account->name, "pass" => "cyan", "init" => db_escape_string($name), "authname_webserver_auth" => $account->name, "status" => 1, "roles" => array(_user_authenticated_id())); |
$user_default = array("name" => $account->name, "pass" => "cyan", "init" => db_escape_string($name), "authname_webserver_auth" => $account->name, "status" => 1, "roles" => array((DRUPAL_AUTHENTICATED_RID)); |
| 27 |
// TODO - the hook_user('register') will fire but only for loaded modules. cold be a problem for sites using page cache and that hook+operation |
// TODO - the hook_user('register') will fire but only for loaded modules. cold be a problem for sites using page cache and that hook+operation |
| 28 |
$user = user_save("", array_merge($user_default, $account)); |
$user = user_save("", array_merge($user_default, (array)$account)); |
| 29 |
watchdog("user", "new user: $user->name (webserver_auth)", l(t("edit user"), "admin/user/edit/$user->uid")); |
watchdog("user", "new user: $user->name (webserver_auth)", l(t("edit user"), "admin/user/edit/$user->uid")); |
| 30 |
} |
} |
| 31 |
} |
} |
| 53 |
} |
} |
| 54 |
|
|
| 55 |
function webserver_auth_settings() { |
function webserver_auth_settings() { |
| 56 |
$output = form_textfield(t("Email Domain"), "webserver_auth_domain", variable_get("webserver_auth_domain", ""), 30, 55, t("Append this domain name to each new user in order generate his email address.")); |
$form["webserver_auth_domain"] = array( |
| 57 |
return $output; |
'#type' => 'textfield', |
| 58 |
|
'#title' => t("Email Domain"), |
| 59 |
|
'#default_value' => variable_get("webserver_auth_domain", ""), |
| 60 |
|
'#size' => 30, |
| 61 |
|
'#maxlength' => 55, |
| 62 |
|
'#description' => t("Append this domain name to each new user in order generate his email address."), |
| 63 |
|
); |
| 64 |
|
return $form; |
| 65 |
} |
} |
| 66 |
|
|
| 67 |
function webserver_auth_help($section) { |
function webserver_auth_help($section) { |