From f6f3c48d263191a262e9d9c63fe701384bbae9ab Mon Sep 17 00:00:00 2001 From: "Paul W. Frields" Date: Sun, 11 Jul 2010 12:37:46 -0400 Subject: Use username and password for FAS URL verify --- authfas.module | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/authfas.module b/authfas.module index 434df8c..560998e 100644 --- a/authfas.module +++ b/authfas.module @@ -124,10 +124,13 @@ function authfas_admin_validate($form, &$form_state) { $ch = curl_init(); $fasurl = $form_state['values']['authfas_fasurl']; + $username = $form_state['values']['fas_username']; + $password = $form_state['values']['fas_password']; // Expect a JSON interface to be present - curl_setopt($ch, CURLOPT_URL, 'https://' . $fasurl . '/json'); + curl_setopt($ch, CURLOPT_URL, 'https://'.$fasurl.'/json/'); curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_USERAGENT, "Auth_FAS 0.9"); + curl_setopt($ch, CURLOPT_USERAGENT, "Drupal AuthFAS 0.1"); + curl_setopt($ch, CURLOPT_POSTFIELDS, "username=".urlencode($username)."&user_name=".urlencode($username)."&password=".urlencode($password)."&login=Login"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // The following two lines need to be enabled when using a test FAS // with an invalid cert. Otherwise they should be commented (or @@ -138,7 +141,7 @@ function authfas_admin_validate($form, &$form_state) { curl_close ($ch); if (!isset($response["help"])) { - form_set_error("authfas_fasurl", 'No JSON interface present at https://' .$fasurl. '/json'); + form_set_error("authfas_fasurl", 'No JSON interface present at https://'.$fasurl.'/json/ or could not verify username "'.$username.'".'); return FALSE; } return TRUE; -- cgit