diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index <HASH>..<HASH> 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -2627,6 +2627,17 @@ function authenticate_user_login($username, $password) {
                 }
             }
         }
+
+    /// Log in to a second system if necessary
+        if (!empty($CFG->sso)) {
+            include_once($CFG->dirroot .'/sso/'. $CFG->sso .'/lib.php');
+            if (function_exists('sso_user_login')) {
+                if (!sso_user_login($username, $password)) {   // Perform the signon process
+                    notify('Second sign-on failed');
+                }
+            }
+        }
+
         return $user;
 
     } else {
Added hooks for new SSO capability (Single-Sign-On or Second-Sign-On)