pg_rails 7.6.27 → 7.6.29

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01d6c43a4f1804b0b45e92ebaeea5411deb1fa6dafd9a886d3ca6fe9f5151fb3
4
- data.tar.gz: 0b1eaf69bc0fd4d9164329b90c45ed1e206195a411b060cb0ab41ec28e3eae62
3
+ metadata.gz: 1fcc25eb9f5bfd935e0f470855b7ad4ac689fc5142a31ff4ef862daafc26a289
4
+ data.tar.gz: 82969f474062c70b3ba94bf11313ca0606f3f00f1e0106af7525ab39b7c48d7b
5
5
  SHA512:
6
- metadata.gz: d2521275d846111b2386211c36524c21b0d13de8db05cc0e28fd713021ece959a0f9deb7887d9d0ec8cf20229509dff6c1feed6d67cc14934beeb44fd38feed9
7
- data.tar.gz: 90fc3ad22510450edc3d19c0bc11f9dfba1de6471a42c2478541d4808abe69eb668f3506b44137dd815e4067d81f632ed91bdb457145eec6d11d508ae310239f
6
+ metadata.gz: 725997c33ad64427b695321bc271c3c85f74e838238c0d250c0078ef2b3a0c8e69384fe47e92e720af2d2b62bf38983251b05a83e16c9200d63d2e8dd0609f2a
7
+ data.tar.gz: ae85d535f09c48c99c8311d19218f897c04ee6f8178ef3741bb23652923dfa2d4590801d7de858a2afeba0c8def2a1f7cb9b4f116cef59be69b25835d2c824ab
@@ -23,6 +23,11 @@ nav[aria-label=breadcrumb] a {
23
23
  }
24
24
 
25
25
  // FORMS
26
+ // Form floating
27
+ .form-floating > .form-control ~ label::after {
28
+ // Para que cuando es un invalid field no choque el background de la label
29
+ background-color: transparent!important;
30
+ }
26
31
 
27
32
  // Radio buttons
28
33
  .radio_buttons legend {
@@ -1,3 +1,4 @@
1
+ # :nocov:
1
2
  module PgEngine
2
3
  class HealthController < ApplicationController
3
4
  rescue_from(Exception) do |error|
@@ -9,6 +10,7 @@ module PgEngine
9
10
  check_redis
10
11
  check_postgres
11
12
  check_websocket
13
+ check_ssl
12
14
  render_up
13
15
  end
14
16
 
@@ -55,6 +57,27 @@ module PgEngine
55
57
  end
56
58
  # rubocop:enable Metrics/MethodLength
57
59
 
60
+ def check_ssl
61
+ raise PgEngine::Error, 'no ssl log file' unless File.exist?(PgEngine::SslVerifier::OUTPUT_PATH)
62
+
63
+ sites = JSON.parse(File.read(PgEngine::SslVerifier::OUTPUT_PATH))
64
+ PgEngine.config.health_ssl_urls.each do |url|
65
+ check_site_ssl(sites, url)
66
+ end
67
+ end
68
+
69
+ def check_site_ssl(sites, url)
70
+ raise PgEngine::Error, "SSL record not present: #{url}" if sites[url].blank?
71
+
72
+ if Time.zone.parse(sites[url]['verified_at']) < 2.days.ago
73
+ raise PgEngine::Error, "The SSL info is outdated: #{url}"
74
+ end
75
+
76
+ return unless Time.zone.parse(sites[url]['expires_at']) < 7.days.from_now
77
+
78
+ raise PgEngine::Error, "The SSL certificate is expired (or about to expire): #{url}"
79
+ end
80
+
58
81
  def render_up
59
82
  render html: html_status(color: '#005500')
60
83
  end
@@ -68,3 +91,4 @@ module PgEngine
68
91
  end
69
92
  end
70
93
  end
94
+ # :nocov:
@@ -4,13 +4,14 @@
4
4
 
5
5
  module PgEngine
6
6
  class Configuracion
7
- attr_accessor :users_controller, :global_domains, :navigators, :user_profiles
7
+ attr_accessor :users_controller, :global_domains, :navigators, :user_profiles, :health_ssl_urls
8
8
 
9
9
  # attr_accessor :profile_groups
10
10
 
11
11
  def initialize
12
12
  @global_domains = ['app.localhost.com', 'test.host', 'localhost']
13
13
  @navigators = [PgEngine::Navigator.new]
14
+ @health_ssl_urls = []
14
15
  # @profile_groups = [:account]
15
16
  @user_profiles = {
16
17
  account__owner: 0
@@ -0,0 +1,65 @@
1
+ # :nocov:
2
+ module PgEngine
3
+ class SslVerifier
4
+ OUTPUT_PATH = 'tmp/ssl_verifier.json'.freeze
5
+
6
+ def run
7
+ PgEngine.config.health_ssl_urls.each do |url|
8
+ check_ssl(url)
9
+ end
10
+ end
11
+
12
+ def check_ssl(url)
13
+ uri = URI.parse(url)
14
+ http_session = Net::HTTP.new(uri.host, uri.port)
15
+
16
+ # Use SSL/TLS
17
+ http_session.use_ssl = true
18
+
19
+ # Create a request
20
+ request = Net::HTTP::Get.new(uri.request_uri)
21
+
22
+ begin
23
+ # Start the HTTP session
24
+ http_session.start do |http|
25
+ http.request(request)
26
+
27
+ # Check the response code
28
+
29
+ # Get the SSL certificate
30
+ cert = http.peer_cert
31
+
32
+ raise PgEngine::Error, "#{url}: No SSL certificate found." unless cert
33
+ # puts "Certificate Subject: #{cert.subject}"
34
+ # puts "Certificate Issuer: #{cert.issuer}"
35
+ # puts "Certificate Valid From: #{cert.not_before}"
36
+ # puts "Certificate Valid Until: #{cert.not_after}"
37
+
38
+ if cert.not_after < 7.days.from_now
39
+ raise PgEngine::Error, "#{url}: The SSL certificate is expired (or about to expire)."
40
+ end
41
+
42
+ log_output(url, cert.not_after)
43
+ end
44
+ rescue OpenSSL::SSL::SSLError => e
45
+ raise PgEngine::Error, "#{url}: SSL Error: #{e.message}"
46
+ rescue StandardError => e
47
+ raise PgEngine::Error, "#{url}: An error occurred: #{e.message}"
48
+ end
49
+ end
50
+
51
+ def log_output(url, expires_at)
52
+ current_content =
53
+ if File.exist?(OUTPUT_PATH)
54
+ JSON.parse(File.read(OUTPUT_PATH))
55
+ else
56
+ {}
57
+ end
58
+
59
+ current_content[url] = { verified_at: Time.current, expires_at: }
60
+
61
+ File.write(OUTPUT_PATH, current_content.to_json)
62
+ end
63
+ end
64
+ end
65
+ # :nocov:
@@ -11,6 +11,7 @@ require_relative 'pg_engine/email_observer'
11
11
  require_relative 'pg_engine/mailgun/log_sync'
12
12
  require_relative 'pg_engine/route_helpers'
13
13
  require_relative 'pg_engine/utils/pg_logger'
14
+ require_relative 'pg_engine/utils/ssl_verifier'
14
15
  require_relative 'pg_engine/utils/pdf_preview_generator'
15
16
 
16
17
  require_relative '../app/helpers/pg_engine/print_helper'
@@ -0,0 +1,18 @@
1
+ # require 'rails_helper'
2
+ #
3
+ # describe PgEngine::SslVerifier do
4
+ # describe 'check_ssl' do
5
+ # subject do
6
+ # described_class.new.check_ssl(url)
7
+ # end
8
+ #
9
+ # let(:url) { 'https://factura.bien.com.ar' }
10
+ # let(:output_file) { File.read(PgEngine::SslVerifier::OUTPUT_PATH) }
11
+ # let(:output_json) { JSON.parse(output_file) }
12
+ #
13
+ # it 'checks the SSL certificate and saves the file' do
14
+ # expect { subject }.not_to raise_error
15
+ # expect(output_json.keys).to include 'https://bien.com.ar'
16
+ # end
17
+ # end
18
+ # end
@@ -6,7 +6,7 @@
6
6
 
7
7
  <%= render FlashContainerComponent.new %>
8
8
 
9
- <%= pg_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
9
+ <%= pg_form_for(resource, as: resource_name, url: session_path(resource_name), wrapper: :floating_labels_form) do |f| %>
10
10
  <div class="form-inputs">
11
11
  <%= f.input :email,
12
12
  required: false,
@@ -16,7 +16,13 @@
16
16
  required: false,
17
17
  input_html: { autocomplete: "current-password" } %>
18
18
  <%#= f.input :remember_me, as: :hidden if devise_mapping.rememberable? %>
19
- <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
19
+ <div class="mb-3">
20
+ <%= f.input_field :remember_me, as: :boolean, class: 'form-check-input' if devise_mapping.rememberable? %>
21
+ <label class="mx-1" for="user_remember_me">Recordarme</label>
22
+ <span data-controller="tooltip" data-bs-title="No volver a solicitar credenciales por un mes en este navegador">
23
+ <i class="bi bi-info-circle"></i>
24
+ </span>
25
+ </div>
20
26
  </div>
21
27
 
22
28
  <div class="form-actions">
@@ -1,22 +1,32 @@
1
- <div class="devise-links">
1
+ <div class="devise-links d-flex flex-column justify-content-center gap-3">
2
2
  <%- if controller_name != 'sessions' %>
3
- <%= link_to t(".sign_in"), new_session_path(resource_name) %>
3
+ <div>
4
+ <%= link_to t(".sign_in"), new_session_path(resource_name) %>
5
+ </div>
4
6
  <% end %>
5
7
 
6
8
  <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
7
- <%= link_to t(".sign_up"), new_registration_path(resource_name) %>
9
+ <div>
10
+ <%= link_to t(".sign_up"), new_registration_path(resource_name) %>
11
+ </div>
8
12
  <% end %>
9
13
 
10
14
  <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
11
- <%= link_to t(".forgot_your_password"), new_password_path(resource_name) %>
15
+ <div>
16
+ <%= link_to t(".forgot_your_password"), new_password_path(resource_name) %>
17
+ </div>
12
18
  <% end %>
13
19
 
14
20
  <%- if false # devise_mapping.confirmable? && controller_name != 'confirmations' %>
15
- <%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %>
21
+ <div>
22
+ <%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %>
23
+ </div>
16
24
  <% end %>
17
25
 
18
26
  <%- if false # devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
27
+ <div>
19
28
  <%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %>
29
+ </div>
20
30
  <% end %>
21
31
 
22
32
  <%- if devise_mapping.omniauthable? %>
@@ -29,8 +39,4 @@
29
39
  .devise-links {
30
40
  margin-top: 3em;
31
41
  }
32
- .devise-links a {
33
- display: block;
34
- margin-top: 1em;
35
- }
36
- </style>
42
+ </style>
@@ -2,6 +2,6 @@
2
2
 
3
3
  # :nocov:
4
4
  module PgRails
5
- VERSION = '7.6.27'
5
+ VERSION = '7.6.29'
6
6
  end
7
7
  # :nocov:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.27
4
+ version: 7.6.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-10 00:00:00.000000000 Z
11
+ date: 2025-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -893,6 +893,7 @@ files:
893
893
  - pg_engine/lib/pg_engine/utils/pdf_preview_generator.rb
894
894
  - pg_engine/lib/pg_engine/utils/pg_logger.rb
895
895
  - pg_engine/lib/pg_engine/utils/resource_reports.rb
896
+ - pg_engine/lib/pg_engine/utils/ssl_verifier.rb
896
897
  - pg_engine/lib/tasks/auto_anotar_modelos.rake
897
898
  - pg_engine/spec/components/alert_component_spec.rb
898
899
  - pg_engine/spec/components/internal_error_component_spec.rb
@@ -930,6 +931,7 @@ files:
930
931
  - pg_engine/spec/lib/pg_engine/form_helper_spec.rb
931
932
  - pg_engine/spec/lib/pg_engine/mailgun/log_sync_spec.rb
932
933
  - pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
934
+ - pg_engine/spec/lib/pg_engine/utils/ssl_verifier_spec.rb
933
935
  - pg_engine/spec/lib/pg_form_builder_spec.rb
934
936
  - pg_engine/spec/mailers/pg_engine/base_mailer_spec.rb
935
937
  - pg_engine/spec/mailers/previews/devise_preview.rb