summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/auth_sources_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb
index 8e2e1f001..e94df3c0e 100644
--- a/app/controllers/auth_sources_controller.rb
+++ b/app/controllers/auth_sources_controller.rb
@@ -72,6 +72,20 @@ class AuthSourcesController < ApplicationController
redirect_to auth_sources_path
end
+ def autocomplete_for_new_user
+ results = AuthSource.search(params[:term])
+
+ render :json => results.map {|result| {
+ 'value' => result[:login],
+ 'label' => "#{result[:login]} (#{result[:firstname]} #{result[:lastname]})",
+ 'login' => result[:login].to_s,
+ 'firstname' => result[:firstname].to_s,
+ 'lastname' => result[:lastname].to_s,
+ 'mail' => result[:mail].to_s,
+ 'auth_source_id' => result[:auth_source_id].to_s
+ }}
+ end
+
private
def find_auth_source