You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2012/03/15 15:16:33 UTC

svn commit: r1300992 - /incubator/vcl/trunk/web/.ht-inc/authentication.php

Author: jfthomps
Date: Thu Mar 15 14:16:33 2012
New Revision: 1300992

URL: http://svn.apache.org/viewvc?rev=1300992&view=rev
Log:
modified selectAuth - removed label from "Remeber my selection" to make it harder to accidentally select it
modified ldapLogin - if we receive "Invalid credentials" from the ldap server, pass that along to addLoginLog
modified addLoginLog - added $code as an optional argument; insert it as code into database

Modified:
    incubator/vcl/trunk/web/.ht-inc/authentication.php

Modified: incubator/vcl/trunk/web/.ht-inc/authentication.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/authentication.php?rev=1300992&r1=1300991&r2=1300992&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/authentication.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/authentication.php Thu Mar 15 14:16:33 2012
@@ -172,7 +172,7 @@ function selectAuth() {
 		printSelectInput("authtype", $methods, -1, 0, 0, '', 'tabindex=1');
 	print "<br><INPUT type=hidden name=mode value=selectauth>\n";
 	print "<input type=checkbox id=remsel name=remsel value=1 tabindex=2>\n";
-	print "<label for=remsel>Remember my selection</label><br>\n";
+	print "Remember my selection<br>\n";
 	print "<INPUT type=submit value=\"Proceed to Login\" tabindex=3 name=userid>\n";
 	print "</FORM>\n";
 	print "</TD>\n";
@@ -447,7 +447,11 @@ function ldapLogin($authtype, $userid, $
 	$res = ldap_bind($ds, $ldapuser, $passwd);
 	if(! $res) {
 		// login failed
-		addLoginLog($userid, $authtype, $authMechs[$authtype]['affiliationid'], 0);
+		$err = ldap_error($ds);
+		if($err == 'Invalid credentials')
+			addLoginLog($userid, $authtype, $authMechs[$authtype]['affiliationid'], 0, $err);
+		else
+			addLoginLog($userid, $authtype, $authMechs[$authtype]['affiliationid'], 0);
 		printLoginPageWithSkin($authtype);
 		return;
 	}
@@ -568,17 +572,18 @@ function validateLocalAccount($user, $pa
 
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \fn addLoginLog($login, $mech, $affiliationid, $passfail)
+/// \fn addLoginLog($login, $mech, $affiliationid, $passfail, $code)
 ///
 /// \param $login - user id entered in login screen
 /// \param $mech - authentication mechanism used
 /// \param $affiliationid - affiliation id of authentication mechanism
 /// \param $passfail - 1 for successful login, 0 for failed login
+/// \param $code - (optional, default='none') additional code to save
 ///
 /// \brief adds an entry to the loginlog table
 ///
 ////////////////////////////////////////////////////////////////////////////////
-function addLoginLog($login, $mech, $affiliationid, $passfail) {
+function addLoginLog($login, $mech, $affiliationid, $passfail, $code='none') {
 	$login = mysql_real_escape_string($login);
 	$mech = mysql_real_escape_string($mech);
 	$query = "INSERT INTO loginlog "
@@ -586,13 +591,15 @@ function addLoginLog($login, $mech, $aff
 	       .        "authmech, "
 	       .        "affiliationid, "
 	       .        "passfail, "
-	       .        "remoteIP) "
+	       .        "remoteIP, "
+	       .        "code) "
 	       . "VALUES "
 	       .        "('$login', "
 	       .        "'$mech', "
 	       .        "$affiliationid, "
 	       .        "$passfail, "
-	       .        "'{$_SERVER['REMOTE_ADDR']}')";
+	       .        "'{$_SERVER['REMOTE_ADDR']}', "
+	       .        "'$code')";
 	doQuery($query, 101);
 }