zuora_connect 0 → 3.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +219 -0
  4. data/Rakefile +1 -1
  5. data/app/assets/javascripts/hallway_wrapper/after.js +22 -3
  6. data/app/controllers/concerns/zuora_connect/authenticate.rb +39 -0
  7. data/app/controllers/zuora_connect/api/v1/app_instance_controller.rb +5 -0
  8. data/app/controllers/zuora_connect/application_controller.rb +37 -2
  9. data/app/controllers/zuora_connect/static_controller.rb +142 -27
  10. data/app/helpers/zuora_connect/LDAP/adapter.rb +16 -0
  11. data/app/helpers/zuora_connect/LDAP/connection.rb +123 -0
  12. data/app/helpers/zuora_connect/application_helper.rb +10 -0
  13. data/app/models/concerns/zuora_connect/auditable.rb +29 -0
  14. data/app/models/zuora_connect/app_instance_base.rb +652 -180
  15. data/app/models/zuora_connect/login.rb +24 -11
  16. data/app/models/zuora_connect/telegraf.rb +18 -38
  17. data/app/models/zuora_connect/zuora_user.rb +35 -0
  18. data/app/views/sql/refresh_aggregate_table.txt +12 -10
  19. data/app/views/zuora_connect/application/ldap_login.html.erb +195 -0
  20. data/app/views/zuora_connect/static/error_handled.html.erb +76 -0
  21. data/app/views/zuora_connect/static/error_handled.js.erb +1 -0
  22. data/app/views/zuora_connect/static/error_unhandled.erb +85 -0
  23. data/app/views/zuora_connect/static/error_unhandled.js.erb +1 -0
  24. data/app/views/zuora_connect/static/launch.html.erb +71 -76
  25. data/config/initializers/object_method_hooks.rb +2 -2
  26. data/config/initializers/patches.rb +9 -0
  27. data/config/initializers/postgresql_adapter.rb +119 -1
  28. data/config/initializers/prometheus.rb +57 -23
  29. data/config/initializers/redis.rb +52 -5
  30. data/config/initializers/resque.rb +5 -1
  31. data/config/initializers/unicorn.rb +30 -2
  32. data/config/initializers/zuora_observability.rb +24 -0
  33. data/config/routes.rb +8 -3
  34. data/db/migrate/20100718151733_create_connect_app_instances.rb +1 -1
  35. data/db/migrate/20101024162319_add_tokens_to_app_instance.rb +1 -1
  36. data/db/migrate/20101024220705_add_token_to_app_instance.rb +1 -1
  37. data/db/migrate/20110131211919_add_sessions_table.rb +1 -1
  38. data/db/migrate/20110411200303_add_expiration_to_app_instance.rb +1 -1
  39. data/db/migrate/20110413191512_add_new_api_token.rb +1 -1
  40. data/db/migrate/20110503003602_add_catalog_data_to_app_instance.rb +1 -1
  41. data/db/migrate/20110503003603_add_catalog_mappings_to_app_instance.rb +1 -1
  42. data/db/migrate/20110503003604_catalog_default.rb +1 -1
  43. data/db/migrate/20180301052853_add_catalog_attempted_at.rb +1 -1
  44. data/db/migrate/20181206162339_add_fields_to_instance.rb +1 -1
  45. data/db/migrate/20190520232221_add_zuora_user_table_and_alter_app_instance_id_table.rb +18 -0
  46. data/db/migrate/20190520232222_add_unique_index.rb +6 -0
  47. data/db/migrate/20190520232223_add_provisioning_fields.rb +6 -0
  48. data/db/migrate/20190520232224_add_environment_fields.rb +16 -0
  49. data/lib/metrics/net.rb +3 -3
  50. data/lib/middleware/json_parse_errors.rb +33 -0
  51. data/lib/middleware/metrics_middleware.rb +62 -68
  52. data/lib/middleware/request_id_middleware.rb +17 -0
  53. data/lib/resque/dynamic_queues.rb +35 -13
  54. data/lib/resque/plugins/app_instance_job.rb +63 -0
  55. data/lib/resque/plugins/custom_logger.rb +12 -27
  56. data/lib/tasks/zuora_connect_tasks.rake +0 -5
  57. data/lib/zuora_connect/configuration.rb +8 -4
  58. data/lib/zuora_connect/controllers/helpers.rb +640 -189
  59. data/lib/zuora_connect/engine.rb +12 -9
  60. data/lib/zuora_connect/exceptions.rb +18 -2
  61. data/lib/zuora_connect/middleware/hallway.rb +34 -0
  62. data/lib/zuora_connect/railtie.rb +16 -39
  63. data/lib/zuora_connect/version.rb +3 -1
  64. data/lib/zuora_connect.rb +69 -5
  65. metadata +146 -126
  66. data/app/views/zuora_connect/static/invalid_app_instance_error.html.erb +0 -65
  67. data/app/views/zuora_connect/static/invalid_launch_request.html +0 -65
  68. data/app/views/zuora_connect/static/session_error.html.erb +0 -63
  69. data/config/initializers/elastic_apm.rb +0 -25
  70. data/lib/zuora_connect/views/helpers.rb +0 -9
  71. data/test/controllers/zuora_connect/api/v1/app_instance_controller_test.rb +0 -13
  72. data/test/dummy/README.rdoc +0 -28
  73. data/test/dummy/Rakefile +0 -6
  74. data/test/dummy/app/assets/javascripts/application.js +0 -13
  75. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  76. data/test/dummy/app/controllers/application_controller.rb +0 -5
  77. data/test/dummy/app/helpers/application_helper.rb +0 -2
  78. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  79. data/test/dummy/bin/bundle +0 -3
  80. data/test/dummy/bin/rails +0 -4
  81. data/test/dummy/bin/rake +0 -4
  82. data/test/dummy/bin/setup +0 -29
  83. data/test/dummy/config/application.rb +0 -26
  84. data/test/dummy/config/boot.rb +0 -5
  85. data/test/dummy/config/database.yml +0 -25
  86. data/test/dummy/config/environment.rb +0 -5
  87. data/test/dummy/config/environments/development.rb +0 -41
  88. data/test/dummy/config/environments/production.rb +0 -79
  89. data/test/dummy/config/environments/test.rb +0 -42
  90. data/test/dummy/config/initializers/assets.rb +0 -11
  91. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  92. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  93. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  94. data/test/dummy/config/initializers/inflections.rb +0 -16
  95. data/test/dummy/config/initializers/mime_types.rb +0 -4
  96. data/test/dummy/config/initializers/session_store.rb +0 -3
  97. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  98. data/test/dummy/config/locales/en.yml +0 -23
  99. data/test/dummy/config/routes.rb +0 -4
  100. data/test/dummy/config/secrets.yml +0 -22
  101. data/test/dummy/config.ru +0 -4
  102. data/test/dummy/public/404.html +0 -67
  103. data/test/dummy/public/422.html +0 -67
  104. data/test/dummy/public/500.html +0 -66
  105. data/test/dummy/public/favicon.ico +0 -0
  106. data/test/fixtures/zuora_connect/app_instances.yml +0 -11
  107. data/test/integration/navigation_test.rb +0 -8
  108. data/test/lib/generators/zuora_connect/datatable_generator_test.rb +0 -16
  109. data/test/models/zuora_connect/app_instance_test.rb +0 -9
  110. data/test/test_helper.rb +0 -21
  111. data/test/zuora_connect_test.rb +0 -7
@@ -1,26 +1,29 @@
1
1
  module ZuoraConnect
2
2
  class Login
3
-
3
+ attr_accessor :clients, :identifier_to_ids, :default_entity
4
4
  def initialize (fields)
5
- @clients = {}
5
+ self.clients = {}
6
+ self.identifier_to_ids = {}
6
7
  if fields["tenant_type"] == "Zuora"
7
8
  login_fields = fields.map{|k,v| [k.to_sym, v]}.to_h
8
9
  login_type = fields.dig("authentication_type").blank? ? 'Basic' : fields.dig("authentication_type").capitalize
9
10
 
10
- @clients["Default"] = "::ZuoraAPI::#{login_type}".constantize.new(login_fields)
11
- @default_entity = fields["entities"][0]["id"] if (fields.dig("entities") || []).size == 1
11
+ raise ZuoraConnect::Exceptions::InvalidCredentialSet.new("Cannot setup application with ZSession Login.") if login_type == "Session"
12
+ self.clients["Default"] = "::ZuoraAPI::#{login_type}".constantize.new(**login_fields)
13
+ self.default_entity = fields["entities"][0]["id"] if (fields.dig("entities") || []).size == 1
12
14
  if fields["entities"] && fields["entities"].size > 0
13
15
  fields["entities"].each do |entity|
14
- params = {:entity_id => entity["id"]}.merge(login_fields)
15
- @clients[entity["id"]] = "::ZuoraAPI::#{login_type}".constantize.new(params)
16
+ params = {:entity_id => entity["id"], :entity_identifier => entity["identifier"]}.merge(login_fields)
17
+ self.clients[entity["id"]] = "::ZuoraAPI::#{login_type}".constantize.new(**params)
18
+ self.identifier_to_ids[entity["identifier"]] = entity["id"]
16
19
  end
17
20
  end
18
- self.attr_builder("available_entities", @clients.keys)
21
+ self.attr_builder("available_entities", self.clients.keys)
19
22
  end
20
23
  fields.each do |k,v|
21
24
  self.attr_builder(k,v)
22
25
  end
23
- @default_entity ||= "Default"
26
+ self.default_entity ||= "Default"
24
27
  end
25
28
 
26
29
  def attr_builder(field,val)
@@ -28,9 +31,19 @@ module ZuoraConnect
28
31
  send("#{field}=", val)
29
32
  end
30
33
 
31
- def client(id = @default_entity)
32
- return id.blank? ? @clients[@default_entity] : @clients[id]
33
- end
34
+ def client(id = self.default_entity)
35
+ use_entity_name = self.identifier_to_ids.keys.include?(id)
36
+
37
+ # Translate entity name to entity id
38
+ id = self.identifier_to_ids[id] if use_entity_name
39
+
40
+ client = id.blank? ? self.clients[self.default_entity] : self.clients[id]
34
41
 
42
+ if client
43
+ client.entity_header_type = use_entity_name ? :entity_name : :entity_id
44
+ end
45
+
46
+ client
47
+ end
35
48
  end
36
49
  end
@@ -2,24 +2,24 @@ module ZuoraConnect
2
2
  class Telegraf
3
3
  attr_accessor :host
4
4
 
5
- OUTBOUND_METRICS = true
6
- OUTBOUND_METRICS_NAME = "request-outbound"
7
- INBOUND_METRICS = true
8
- INBOUND_METRICS_NAME = "request-inbound"
5
+ OUTBOUND_METRICS = true
6
+ OUTBOUND_METRICS_NAME = "request-outbound"
7
+ INBOUND_METRICS = true
8
+ INBOUND_METRICS_NAME = "request-inbound"
9
9
 
10
- def initialize
10
+ def initialize
11
11
  self.connect
12
12
  end
13
13
 
14
14
  def connect
15
- Rails.logger.debug(self.format_metric_log('Telegraf','Need new connection')) if ZuoraConnect.configuration.telegraf_debug
15
+ ZuoraConnect.logger.debug(self.format_metric_log('Telegraf','Need new connection')) if ZuoraConnect.configuration.telegraf_debug
16
16
  uri = URI.parse(ZuoraConnect.configuration.telegraf_endpoint)
17
17
  self.host = UDPSocket.new.tap do |socket|
18
18
  socket.connect uri.host, uri.port
19
19
  end
20
20
  rescue => ex
21
21
  self.host = nil
22
- Rails.logger.warn(self.format_metric_log('Telegraf', "Failed to connect: #{ex.class}"))
22
+ ZuoraConnect.logger.warn(self.format_metric_log('Telegraf', "Failed to connect: #{ex.class}")) if Rails.env.to_s != 'production'
23
23
  end
24
24
 
25
25
  def write(direction: 'Unknown', tags: {}, values: {})
@@ -27,11 +27,11 @@ module ZuoraConnect
27
27
  # To avoid writing metrics from rspec tests
28
28
  if Rails.env.to_sym != :test
29
29
  app_instance = Thread.current[:appinstance].present? ? Thread.current[:appinstance].id : 0
30
- tags = { app_name: self.class.app_name, process_type: self.class.process_type, app_instance: app_instance, pod_name: self.class.pod_name}.merge(tags)
30
+ tags = { app_name: ZuoraObservability::Env.app_name, process_type: ZuoraObservability::Env.process_type, app_instance: app_instance, pod_name: ZuoraObservability::Env.pod_name}.merge(tags)
31
31
 
32
32
  if direction == :inbound
33
33
  if INBOUND_METRICS && !Thread.current[:inbound_metric].to_bool
34
- self.write_udp(series: INBOUND_METRICS_NAME, tags: tags, values: values)
34
+ self.write_udp(series: INBOUND_METRICS_NAME, tags: tags, values: values)
35
35
  Thread.current[:inbound_metric] = true
36
36
  else
37
37
  return
@@ -44,50 +44,30 @@ module ZuoraConnect
44
44
  end
45
45
  end
46
46
  if ZuoraConnect.configuration.telegraf_debug
47
- Rails.logger.debug(self.format_metric_log('Telegraf', tags.to_s))
48
- Rails.logger.debug(self.format_metric_log('Telegraf', values.to_s))
49
- Rails.logger.debug(self.format_metric_log('Telegraf', "Writing '#{direction.capitalize}': #{time.real.round(5)} ms"))
47
+ ZuoraConnect.logger.debug(self.format_metric_log('Telegraf', tags.to_s))
48
+ ZuoraConnect.logger.debug(self.format_metric_log('Telegraf', values.to_s))
49
+ ZuoraConnect.logger.debug(self.format_metric_log('Telegraf', "Writing '#{direction.capitalize}': #{time.real.round(5)} ms"))
50
50
  end
51
51
  end
52
52
 
53
53
 
54
54
  def write_udp(series: '', tags: {}, values: {})
55
55
  return if !values.present?
56
- self.host.write InfluxDB::PointValue.new({series: series, tags: tags, values: values}).dump
56
+ self.host.write InfluxDB::PointValue.new({series: series, tags: tags, values: values}).dump
57
57
  rescue => ex
58
58
  self.connect
59
- Rails.logger.warn(self.format_metric_log('Telegraf',"Failed to write udp: #{ex.class}"))
59
+ ZuoraConnect.logger.warn(self.format_metric_log('Telegraf',"Failed to write udp: #{ex.class}")) if Rails.env.to_s != 'production'
60
60
  end
61
61
 
62
62
  def format_metric_log(message, dump = nil)
63
63
  message_color, dump_color = "1;91", "0;1"
64
64
  log_entry = " \e[#{message_color}m#{message}\e[0m "
65
65
  log_entry << "\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\e[0m" % dump if dump
66
- log_entry
67
- end
68
-
69
- def self.app_name
70
- return ENV['DEIS_APP'].present? ? ENV['DEIS_APP'] : Rails.application.class.parent_name
71
- end
72
-
73
- def self.pod_name
74
- return ENV['HOSTNAME'].present? ? ENV['HOSTNAME'] : Socket.gethostname
75
- end
76
-
77
- def self.full_process_name(process_name: nil, function: nil)
78
- keys = [self.pod_name, process_name.present? ? process_name : self.process_type, Process.pid, function]
79
- return keys.compact.join('][').prepend('[').concat(']')
80
- end
81
-
82
- # Returns the process type if any
83
- def self.process_type(default: 'Unknown')
84
- p_type = default
85
- if ENV['HOSTNAME'] && ENV['DEIS_APP']
86
- temp = ENV['HOSTNAME'].split(ENV['DEIS_APP'])[1]
87
- temp = temp.split(/(-[0-9a-zA-Z]{5})$/)[0] # remove the 5 char hash
88
- p_type = temp[1, temp.rindex("-")-1]
66
+ if Rails.env == :development
67
+ log_entry
68
+ else
69
+ [message, dump].compact.join(' - ')
89
70
  end
90
- return p_type
91
71
  end
92
72
  end
93
73
  end
@@ -0,0 +1,35 @@
1
+ module ZuoraConnect
2
+ class ZuoraUser < ActiveRecord::Base
3
+ self.table_name = "zuora_users"
4
+ attr_accessor :session
5
+
6
+ cattr_accessor :current_user_id, :current_org_ids
7
+
8
+ # zuora_user_id/zuora_entity_id both come from cookie or headers
9
+ # zuora_current_identity comes from session
10
+ # app_instance is only needed to try to migrate :/
11
+ def self.update_id_response(zuora_user_id, zuora_entity_id, zuora_current_identity, app_instance, permissions)
12
+ zuora_user = find_or_create_by!(zuora_user_id: zuora_user_id) do |user|
13
+ user.zuora_identity_response = { zuora_entity_id => zuora_current_identity }
14
+ user.app_permissions = permissions
15
+ end
16
+
17
+ zuora_user.zuora_identity_response[zuora_entity_id] = zuora_current_identity
18
+ zuora_user.app_permissions = permissions
19
+
20
+ if zuora_user.changed?
21
+ zuora_user.save!
22
+ end
23
+
24
+ zuora_user
25
+ # NOTE(hartley): this rescue is deprecated. We should not be migrating in production
26
+ rescue ActiveRecord::StatementInvalid => e
27
+ raise unless e.message.include?('PG::UndefinedTable') && e.message.include?('zuora_users')
28
+
29
+ ZuoraConnect.logger.fatal('Error querying zuora_users table: attempting migration to recover')
30
+
31
+ app_instance.apartment_switch(nil, true)
32
+ retry
33
+ end
34
+ end
35
+ end
@@ -1,4 +1,4 @@
1
- CREATE OR REPLACE FUNCTION "shared_extensions".refresh_aggregate_table(aggregate_table_name text, table_name text, filter text, mode text) RETURNS void AS $$
1
+ CREATE OR REPLACE FUNCTION "shared_extensions".refresh_aggregate_table(aggregate_table_name text, table_name text, filter text, mode text, ignore_indexes text[]) RETURNS void AS $$
2
2
  DECLARE
3
3
  schema RECORD;
4
4
  result RECORD;
@@ -18,7 +18,7 @@ BEGIN
18
18
 
19
19
  FOR schema IN EXECUTE
20
20
  format(
21
- 'SELECT schema_name FROM information_schema.schemata WHERE schema_name ~ ''^[0-9]+$'''
21
+ 'SELECT nspname FROM pg_catalog.pg_namespace where nspname ~ ''^[0-9]+$'''
22
22
  )
23
23
  LOOP
24
24
  IF NOT created THEN
@@ -26,7 +26,7 @@ BEGIN
26
26
  EXECUTE format(
27
27
  'CREATE TABLE "public".%I (LIKE %I.%I)',
28
28
  aggregate_table_name,
29
- schema.schema_name, table_name
29
+ schema.nspname, table_name
30
30
  );
31
31
  -- Add a special `schema_name` column, which we'll populate with the name of the schema
32
32
  -- each row originated from
@@ -46,7 +46,8 @@ BEGIN
46
46
  from pg_index ind
47
47
  join pg_class idx on idx.oid = ind.indexrelid
48
48
  join pg_class tbl on tbl.oid = ind.indrelid
49
- left join pg_namespace ns on ns.oid = tbl.relnamespace where idx.relname != concat(table_name, '_pkey') and tbl.relname = table_name and ns.nspname = 'public'
49
+ left join pg_namespace ns on ns.oid = tbl.relnamespace
50
+ where idx.relname != concat(table_name, '_pkey') and tbl.relname = table_name and ns.nspname = 'public' and NOT idx.relname = ANY(ignore_indexes::text[])
50
51
  LOOP
51
52
  BEGIN
52
53
  EXECUTE
@@ -66,18 +67,19 @@ BEGIN
66
67
  -- Finally, we'll select everything from this schema's target table, plus the schema's name,
67
68
  -- and insert them into our new aggregate table
68
69
  EXECUTE format(
69
- 'SELECT string_agg(column_name, '','') from information_schema.columns where table_name = ''%s'' AND table_schema = ''%s''',
70
- table_name, schema.schema_name
70
+ 'SELECT string_agg(column_name, '','' order by column_name) from information_schema.columns where table_name = ''%s'' AND table_schema = ''%s''',
71
+ table_name, schema.nspname
71
72
  ) into fields_order;
72
73
 
73
- raise notice 'Importing Schema %', schema.schema_name;
74
+ raise notice 'Importing Schema %', schema.nspname;
74
75
 
75
76
  EXECUTE format(
76
- 'INSERT INTO "public".%I (schema_name, %s) (SELECT ''%s'' AS schema_name, * FROM %I.%I %s )',
77
+ 'INSERT INTO "public".%I (schema_name, %s) (SELECT ''%s'' AS schema_name, %s FROM %I.%I %s )',
77
78
  aggregate_table_name,
78
79
  fields_order,
79
- schema.schema_name,
80
- schema.schema_name, table_name,
80
+ schema.nspname,
81
+ fields_order,
82
+ schema.nspname, table_name,
81
83
  filter
82
84
  );
83
85
  END LOOP;
@@ -0,0 +1,195 @@
1
+ <html>
2
+ <head>
3
+ <title>LDAP Log in</title>
4
+ <style>
5
+ * {
6
+ box-sizing: border-box;
7
+ margin: 0;
8
+ padding: 0;
9
+ font-family: Raleway, sans-serif;
10
+ }
11
+
12
+ body {
13
+ background: linear-gradient(90deg, #C7C5F4, #776BCC);
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ min-height: 100vh;
21
+ }
22
+
23
+ .screen {
24
+ background: linear-gradient(90deg, #5D54A4, #7C78B8);
25
+ position: relative;
26
+ height: 600px;
27
+ width: 360px;
28
+ box-shadow: 0px 0px 24px #5C5696;
29
+ }
30
+
31
+ .screen__content {
32
+ z-index: 1;
33
+ position: relative;
34
+ height: 100%;
35
+ }
36
+
37
+ .screen__background {
38
+ position: absolute;
39
+ top: 0;
40
+ left: 0;
41
+ right: 0;
42
+ bottom: 0;
43
+ z-index: 0;
44
+ -webkit-clip-path: inset(0 0 0 0);
45
+ clip-path: inset(0 0 0 0);
46
+ }
47
+
48
+ .screen__background__shape {
49
+ transform: rotate(45deg);
50
+ position: absolute;
51
+ }
52
+
53
+ .screen__background__shape1 {
54
+ height: 520px;
55
+ width: 520px;
56
+ background: #FFF;
57
+ top: -50px;
58
+ right: 120px;
59
+ border-radius: 0 72px 0 0;
60
+ }
61
+
62
+ .screen__background__shape2 {
63
+ height: 220px;
64
+ width: 220px;
65
+ background: #6C63AC;
66
+ top: -172px;
67
+ right: 0;
68
+ border-radius: 32px;
69
+ }
70
+
71
+ .screen__background__shape3 {
72
+ height: 540px;
73
+ width: 190px;
74
+ background: linear-gradient(270deg, #5D54A4, #6A679E);
75
+ top: -24px;
76
+ right: 0;
77
+ border-radius: 32px;
78
+ }
79
+
80
+ .screen__background__shape4 {
81
+ height: 400px;
82
+ width: 200px;
83
+ background: #7E7BB9;
84
+ top: 420px;
85
+ right: 50px;
86
+ border-radius: 60px;
87
+ }
88
+
89
+ .login {
90
+ width: 320px;
91
+ padding: 30px;
92
+ padding-top: 156px;
93
+ }
94
+
95
+ .login__field {
96
+ padding: 20px 0px;
97
+ position: relative;
98
+ }
99
+
100
+ .login__icon {
101
+ position: absolute;
102
+ top: 30px;
103
+ color: #7875B5;
104
+ }
105
+
106
+ .login__input {
107
+ border: none;
108
+ border-bottom: 2px solid #D1D1D4;
109
+ background: none;
110
+ padding: 10px;
111
+ padding-left: 24px;
112
+ font-weight: 700;
113
+ width: 75%;
114
+ transition: .2s;
115
+ }
116
+
117
+ .login__input:active,
118
+ .login__input:focus,
119
+ .login__input:hover {
120
+ outline: none;
121
+ border-bottom-color: #6A679E;
122
+ }
123
+
124
+ .login__submit {
125
+ background: #fff;
126
+ font-size: 14px;
127
+ margin-top: 30px;
128
+ padding: 16px 20px;
129
+ border-radius: 26px;
130
+ border: 1px solid #D4D3E8;
131
+ text-transform: uppercase;
132
+ font-weight: 700;
133
+ display: flex;
134
+ align-items: center;
135
+ width: 100%;
136
+ color: #4C489D;
137
+ box-shadow: 0px 2px 2px #5C5696;
138
+ cursor: pointer;
139
+ transition: .2s;
140
+ }
141
+
142
+ .login__submit:active,
143
+ .login__submit:focus,
144
+ .login__submit:hover {
145
+ border-color: #6A679E;
146
+ outline: none;
147
+ }
148
+
149
+ .error{
150
+ color: white;
151
+ margin: 20px;
152
+ margin-top: 130px;
153
+ }
154
+ </style>
155
+ </head>
156
+
157
+ <body>
158
+ <div class="container">
159
+ <div class="screen">
160
+ <div class="screen__content">
161
+
162
+ <%= form_with class: "login", url: "/connect/ldap_login", method: :post do |f| %>
163
+ <div class="login__field">
164
+ <%= f.text_field :ldap_username, placeholder: "Username", class: "login__input" %>
165
+ </div>
166
+
167
+ <div class="login__field">
168
+ <%= f.password_field :ldap_password, placeholder: "Password", class: "login__input" %>
169
+ </div>
170
+
171
+ <%= f.button "Log in", class: "button login__submit" %>
172
+
173
+ <% end %>
174
+
175
+ <% if defined?(message) && defined?(title) %>
176
+ <div class="error">
177
+ <h3><%= title %></h3>
178
+ <p><%= message.html_safe %></p>
179
+ </div>
180
+ <% end %>
181
+
182
+ </div>
183
+
184
+ <div class="screen__background">
185
+ <span class="screen__background__shape screen__background__shape4"></span>
186
+ <span class="screen__background__shape screen__background__shape3"></span>
187
+ <span class="screen__background__shape screen__background__shape2"></span>
188
+ <span class="screen__background__shape screen__background__shape1"></span>
189
+ </div>
190
+
191
+ </div>
192
+ </div>
193
+
194
+ </body>
195
+ </html>
@@ -0,0 +1,76 @@
1
+ <html>
2
+ <head>
3
+ <title>Handled Error</title>
4
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
+ <style>
6
+ body {
7
+ background-color: white;
8
+ margin: 0;
9
+ }
10
+
11
+ div.connect-dialog {
12
+ width: 95%;
13
+ max-width: 33em;
14
+ margin: 4em auto 0;
15
+ color: #2E2F30;
16
+ text-align: center;
17
+ }
18
+
19
+ div.connect-dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #3D4B5A solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+
32
+ div.connect-dialog > h1 {
33
+ font-size: 100%;
34
+ color: #3D4B5A;
35
+ line-height: 1.5em;
36
+ }
37
+ div.connect-dialog > p {
38
+ margin: 0 0 1em;
39
+ padding: 1em;
40
+ background-color: #F7F7F7;
41
+ border: 1px solid #CCC;
42
+ border-right-color: #999;
43
+ border-left-color: #999;
44
+ border-bottom-color: #999;
45
+ border-bottom-left-radius: 4px;
46
+ border-bottom-right-radius: 4px;
47
+ border-top-color: #DADADA;
48
+ color: #666;
49
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
50
+ }
51
+ </style>
52
+ </head>
53
+
54
+ <body>
55
+ <% if defined?(exception) %>
56
+ <div class="connect-dialog" style='max-width: 74em;'>
57
+ <div><h1><%= exception.class %> - '<%= exception.message %>'</h1></div>
58
+ <p style='text-align: left;'>
59
+ <% exception.backtrace.each do |line| %>
60
+ <%= line %><br>
61
+ <% end %>
62
+ </p>
63
+ </div>
64
+ <% elsif defined?(message) && defined?(title) %>
65
+ <div class="connect-dialog">
66
+ <div><h1><%= title %></h1></div>
67
+ <p><%= message.html_safe %></p>
68
+ </div>
69
+ <% else %>
70
+ <div class="dialog">
71
+ <div><h1>The launch url was invalid</h1></div>
72
+ <p>Please try relaunching this application</p>
73
+ </div>
74
+ <% end %>
75
+ </body>
76
+ </html>
@@ -0,0 +1 @@
1
+ $('body').html('<%= escape_javascript render(:template=> "zuora_connect/static/error_handled", :formats => [:html], :locals => local_assigns, :layout => false) %>');
@@ -0,0 +1,85 @@
1
+ <html>
2
+ <head>
3
+ <title>We're sorry, but something went wrong</title>
4
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ margin: 0;
9
+ }
10
+
11
+ div.connect-dialog {
12
+ width: 95%;
13
+ max-width: 33em;
14
+ margin: 4em auto 0;
15
+ color: #2E2F30;
16
+ text-align: center;
17
+ }
18
+
19
+ div.connect-dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #B00100 solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+
32
+ div.connect-dialog > h1 {
33
+ font-size: 100%;
34
+ color: #730E15;
35
+ line-height: 1.5em;
36
+ }
37
+
38
+ div.connect-dialog > p {
39
+ margin: 0 0 1em;
40
+ padding: 1em;
41
+ background-color: #F7F7F7;
42
+ border: 1px solid #CCC;
43
+ border-right-color: #999;
44
+ border-left-color: #999;
45
+ border-bottom-color: #999;
46
+ border-bottom-left-radius: 4px;
47
+ border-bottom-right-radius: 4px;
48
+ border-top-color: #DADADA;
49
+ color: #666;
50
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
51
+ }
52
+ </style>
53
+ </head>
54
+
55
+ <body>
56
+ <!-- This file lives in public/500.html -->
57
+ <% if defined?(exception) %>
58
+ <div class="connect-dialog" style='max-width: 74em;'>
59
+ <div><h1><%= exception.class %> - '<%= exception.message %>'</h1></div>
60
+ <p style='text-align: left;'>
61
+ <% if !defined?(skip_exception) %>
62
+ <% last_line = false %>
63
+ <% exception.backtrace.each do |line| %>
64
+ <% ending = last_line && !line.include?(Rails.root.to_s) ? false : true %>
65
+ <% break if !ending%>
66
+ <% if ending %>
67
+ <%= line %><br>
68
+ <% end %>
69
+ <% last_line = line.include?(Rails.root.to_s) %>
70
+ <% end %>
71
+ <% else %>
72
+ Please contact Zuora Support. RequestId: <%= request.uuid %>
73
+ <% end %>
74
+ </p>
75
+ </div>
76
+ <% else %>
77
+ <div class="connect-dialog">
78
+ <div>
79
+ <h1>The launch url was invalid</h1>
80
+ </div>
81
+ <p>Please try relaunching this application</p>
82
+ </div>
83
+ <% end %>
84
+ </body>
85
+ </html>
@@ -0,0 +1 @@
1
+ $('body').html('<%= escape_javascript render(:template=> "zuora_connect/static/error_unhandled", :formats => [:html], :locals => local_assigns, :layout => false) %>');