diff --git a/app/controllers/redmine_oauth_controller.rb b/app/controllers/redmine_oauth_controller.rb
index 93f928a4a4a1cb561b21a987c84ff73745ee02cb..dfb32cff0ce9cb46ab8a70bafe5df2357a76bead 100644
--- a/app/controllers/redmine_oauth_controller.rb
+++ b/app/controllers/redmine_oauth_controller.rb
@@ -71,7 +71,13 @@ class RedmineOauthController < AccountController
       if user.active?
         successful_authentication(user)
       else
-        account_pending
+        # Redmine 2.4 adds an argument to account_pending
+        if Redmine::VERSION::MAJOR > 2 or
+          (Redmine::VERSION::MAJOR == 2 and Redmine::VERSION::MINOR >= 4)
+          account_pending(user)
+        else
+          account_pending
+        end
       end
     end
   end