--- openid.module.1.1.1 2007-01-29 17:09:37.000000000 -0800 +++ openid.module 2007-02-03 13:52:54.960881334 -0800 @@ -64,6 +64,8 @@ function openid_help($section) { switch ($section) { case 'user/help#openid': return t('Allows users to authenticate via OpenID'); + case 'admin/modules#description': + return t('Allows users to authenticate via OpenID'); } } @@ -114,10 +116,13 @@ function openid_block($op='list', $delta $form['#action'] = url($_GET['q'], drupal_get_destination()); + $items[] = l(t('Create new OpenID account'), 'https://www.myopenid.com/', array('title' => t('Create a new user account.'))); + $form['links'] = array('#value' => theme('item_list', $items)); + $block['subject'] = t("OpenID Login"); $block['content'] = drupal_get_form('openid_login_form', $form); - - return $block; + + return $block; } } @@ -173,7 +178,7 @@ function openid_login_form_submit() { // Add simple registration arguments, but only if the URL // being auth'd doesn't exist in the db. if (!user_get_authmaps(Auth_OpenID::normalizeUrl($identity_url))) { - $auth_request->addExtensionArg('sreg', 'optional', 'email'); + $auth_request->addExtensionArg('sreg', 'optional', 'email,fullname'); $auth_request->addExtensionArg('sreg', 'policy_url', 'http://example.com/policy'); } @@ -235,6 +240,7 @@ function openid_return() { if ($sreg) { $_SESSION['sreg_email'] = $sreg['email']; + $_SESSION['sreg_fullname'] = $sreg['fullname']; } // Give the user a page that will request an email @@ -269,6 +275,14 @@ function openid_email_form() { '#description' => t('Enter your email address.') ); + $form['fullname'] = array('#type' => 'textfield', + '#title' => t('Full name'), + '#default_value' => @$_SESSION['sreg_fullname'], + '#size' => 25, + '#maxlength' => 64, + '#description' => t('Enter your full name.') + ); + $form['submit'] = array('#type' => 'submit', '#value' => t('Submit') ); @@ -276,10 +290,9 @@ function openid_email_form() { $form['#action'] = url('openid/get_email'); $content = sprintf("

Create account with OpenID

Before logging in " . - "with your OpenID (%s), you must enter an email address:

%s", + "with your OpenID (%s), you must enter your name and email address:

%s", $_SESSION['openid'], drupal_get_form('openid_create_account', $form)); - print theme('page', $content); } @@ -299,10 +312,17 @@ function openid_create_account_submit() exit(0); } + if (user_validate_name($query['edit']['fullname']) != NULL) { + $error = user_validate_name($query['edit']['fullname']); + drupal_set_message('Name is invalid. '.$error, 'error'); + header("Location: " . url('openid/get_email')); + exit(0); + } + // Process a form submission for an openid-authenticated user and // create an account for them. - $user = user_save('', array('name' => $_SESSION['openid'], + $user = user_save('', array('name' => $query['edit']['fullname'], 'pass' => user_password(), 'mail' => $query['edit']['email'], 'init' => $_SESSION['openid'],