summaryrefslogtreecommitdiff
path: root/ee/app
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-18 15:03:27 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-22 23:50:55 +0100
commitf10c999bca2b5b37b068ff3680a6e35a6707828d (patch)
treea517f86544c1544ee25d174652a003fff9b199a0 /ee/app
parentc212908aad9b32352653dfe9ca966f148c8dfc1a (diff)
downloadgitlab-ce-f10c999bca2b5b37b068ff3680a6e35a6707828d.tar.gz
Refactor OmniauthCallbacksController to remove duplication
Moves LDAP to its own controller with tests Provides path forward for implementing GroupSaml
Diffstat (limited to 'ee/app')
-rw-r--r--ee/app/controllers/ee/ldap/omniauth_callbacks_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/ee/app/controllers/ee/ldap/omniauth_callbacks_controller.rb b/ee/app/controllers/ee/ldap/omniauth_callbacks_controller.rb
new file mode 100644
index 00000000000..f1e851a210b
--- /dev/null
+++ b/ee/app/controllers/ee/ldap/omniauth_callbacks_controller.rb
@@ -0,0 +1,22 @@
+module EE
+ module Ldap
+ module OmniauthCallbacksController
+ extend ::Gitlab::Utils::Override
+
+ override :sign_in_and_redirect
+ def sign_in_and_redirect(user)
+ # The counter gets incremented in `sign_in_and_redirect`
+ show_ldap_sync_flash if user.sign_in_count == 0
+
+ super
+ end
+
+ private
+
+ def show_ldap_sync_flash
+ flash[:notice] = 'LDAP sync in progress. This could take a few minutes. '\
+ 'Refresh the page to see the changes.'
+ end
+ end
+ end
+end