 cas.module |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cas.module b/cas.module
index a0ce7a0..e0164e6 100644
--- a/cas.module
+++ b/cas.module
@@ -794,10 +794,9 @@ function cas_login_page() {
     $destination = $_SESSION['cas_goto'];
   }
   unset($_SESSION['cas_goto']);
-
-  // Change the user/login and user/register urls to the users current page.
-  if ($destination == 'user/login' || $destination == 'user/register') {
-    $destination = 'user/'. $user->uid;
+  $destination_path = parse_url($destination, PHP_URL_PATH);
+  if ($destination_path == '/user/login') {
+    $destination = variable_get('site_frontpage', 'node');
   }
 
   drupal_goto($destination);
