Index: securesite.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/securesite/Attic/securesite.module,v
retrieving revision 1.2.2.26
diff -u -p -r1.2.2.26 securesite.module
--- securesite.module	10 May 2007 08:47:38 -0000	1.2.2.26
+++ securesite.module	31 Aug 2007 18:26:57 -0000
@@ -181,6 +181,42 @@ function securesite_init() {
   }
   unset($_SESSION['securesite_guest']); // If not a guest make sure to unset guest session.
 
+  // If the login is an openid url, the username will be their openid url
+  if (module_exist("openid") && strpos($edit['name'], 'http') === 0) {
+
+    // If we're using the standard HTTP-AUTH (as opposed to the HTML login
+    // form) then the openid endpoint will be split by the ':' in the URL
+    // with http as the username and //my.openid.endpoint as the password.
+    $url = $edit['name'];
+    if ($securesite_enabled == 1 || $securesite_enabled == 2) {
+      if ($edit['name'] == 'http' || $edit['name'] == 'https') {
+        $url .= ':' . $edit['pass'];
+      }
+    }
+    $url = rtrim($url, ':');
+
+    // Only continue if the url looks like a valid url, otherwise proceed
+    // with normal securesite auth.
+    if (stristr($url, '://') !== FALSE) {
+      // Run an openid submit
+      // The $_POST variable needs to be modified as we're actually trying
+      // to simulate a POST to openid_login_form and drupal_get_form reads
+      // the $_POST variable.
+      $POST_orig = $_POST;
+      $form_values = array();
+      $form_values['openid_url'] = $url;
+      $form_values['openid.return_to'] = url('openid/authenticate', NULL, NULL, TRUE);
+      $form_values['form_id'] = 'openid_login_form_hack';
+      $_POST = array('edit' => $form_values, 'op' => '');
+      openid_login_form_submit('openid_login_form_hack', $form_values);
+      $_POST = $POST_orig;
+
+      // If we make it this far then the user wasn't successfully logged in
+      securesite_user_auth();
+      return;
+    }
+  }
+  
   $account = user_authenticate($edit['name'], $edit['pass']);
 
   if ($account->uid && user_access('access site', $account)) {
