symphonia 6.0.2 → 6.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24d7848d1bca3b518accb57564e9c07c7b4650e5a02e5bd9c3bd33fbe60c5d72
4
- data.tar.gz: '078af52f5b5c5efe3fd4ac6bf2935250e25a83e98bfc842f8878413d21ec86a9'
3
+ metadata.gz: ec631bd4ee68c93f0e8ca81f897621e1c4927c21880ca863e72b1306915787ff
4
+ data.tar.gz: 63fa772a030a929bf685126e2f382708b725db2de17ad44c4a06244d88804b43
5
5
  SHA512:
6
- metadata.gz: 85b194d20074685cd3f206e06be37240876fd805892180e60c38060d366efeb48b662c1296f5b277042778c997588d363224697e2c545f475dc970caae447962
7
- data.tar.gz: b23fad9e94c8d44c72feb31d42666f8bbdc610d9a598830d223a8784b32a1856464596af5ac651cc44a485bd7bf0ea341c5e310d4f9e5e86451209f4bb4fbdca
6
+ metadata.gz: 0b94823eb2f350440833ee4a5ee1395c1c9e38b1cf9a7980513c51ae471a71dbc4693c0730109bb94192bb2cc06135ca5cc3d6a8b95a63b0eba6bef0b2fc85fb
7
+ data.tar.gz: 6b55c817441d57c0a4adee96a5e958eeea04a0e1406107bfda627c893cf5a34114409d385168703da87346f9f5b2fd79351bae92976cb190cfd16ad3ae4f60c3
data/.rubocop.yml CHANGED
@@ -1,36 +1,5 @@
1
- require:
2
- - rubocop-rails
3
- - rubocop-rspec
1
+ inherit_gem:
2
+ symphonia_spec: .rubocop.yml
4
3
 
5
- AllCops:
6
- TargetRubyVersion: 2.5
7
- NewCops: enable
8
-
9
- Layout/EmptyLinesAroundClassBody:
10
- EnforcedStyle: empty_lines_special
11
- Layout/EmptyLinesAroundModuleBody:
12
- EnforcedStyle: empty_lines_except_namespace
13
- Layout/MultilineMethodCallIndentation:
14
- EnforcedStyle: indented_relative_to_receiver
15
-
16
- Metrics/AbcSize:
17
- Enabled: false
18
- Metrics/BlockLength:
19
- Enabled: false
20
- Metrics/MethodLength:
21
- Enabled: false
22
- Naming/VariableNumber:
23
- Enabled: false
24
-
25
- Style/Documentation:
26
- Enabled: false
27
- Style/FrozenStringLiteralComment:
28
- Enabled: false
29
- Style/MutableConstant:
30
- Enabled: false
31
- Style/NegatedIf:
32
- Enabled: false
33
- Style/StringLiterals:
34
- Enabled: false
35
- Style/TrailingCommaInHashLiteral:
36
- EnforcedStyleForMultiline: consistent_comma
4
+ Gemspec/DeprecatedAttributeAssignment:
5
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
+ ## [6.0.5] - 2024-08-02
9
+ ### Fixed
10
+ - missing tests files
11
+
12
+ ## [6.0.4] - 2024-08-02
13
+ ### Changed
14
+ - update dependencies
15
+ - rescue from `ActionController::InvalidAuthenticityToken` in `ApplicationController`
16
+
17
+ ## [6.0.3] - 2024-07-22
18
+ ### Fixed
19
+ - disable Turbo on login form
20
+
21
+ ## [6.0.2] - 2023-10-18
22
+
8
23
  ## [6.0.1] - 2023-07-17
9
24
  ### Fixed
10
25
  - fix InvalidAuthenticityToken error for json request
@@ -94,7 +94,7 @@ module Symphonia
94
94
  @user.unarchive!
95
95
 
96
96
  respond_to do |format|
97
- format.html { redirect_to params[:back_url] || users_url }
97
+ format.html { redirect_to params[:back_url] || users_url, allow_other_host: false }
98
98
  format.xml { head :no_content }
99
99
  end
100
100
  end
@@ -1,17 +1,17 @@
1
1
  <%= f.error_messages %>
2
2
  <%= hidden_field_tag(:back_url, back_url || session[:back_url]) %>
3
- <%= f.text_field :login, required: true, autofocus: true, autocomplete: "username" %>
4
3
 
4
+ <%= f.text_field :login, required: true, autofocus: true, autocomplete: "username" %>
5
5
  <%= f.password_field :password, required: true, autocomplete: "current-password" %>
6
6
 
7
7
  <%= f.form_group :remember_me do %>
8
8
  <%= f.check_box :remember_me %>
9
9
  <% end %>
10
10
 
11
- <%= f.submit t(:button_login), class: 'btn btn-primary btn-block' %>
12
- <% if f.object.is_a?(Symphonia::UserSession) %>
13
- <%= link_to(t(:label_reset_password), lost_password_account_path, remote: true, class: 'btn btn-link btn-sm ') %>
14
- <% if Symphonia.config[:allow_registrations] %>
15
- <%= link_to(t(:button_register), register_path, class: 'btn btn-link btn-sm ') %>
16
- <% end %>
11
+ <%= f.submit t(:button_login), class: "btn btn-primary btn-block" %>
12
+ <% if f.object.is_a?(Symphonia::UserSession) %>
13
+ <%= link_to(t(:label_reset_password), lost_password_account_path, remote: true, class: "btn btn-link btn-sm") %>
14
+ <% if Symphonia.config[:allow_registrations] %>
15
+ <%= link_to(t(:button_register), register_path, class: "btn btn-link btn-sm") %>
17
16
  <% end %>
17
+ <% end %>
@@ -2,8 +2,8 @@
2
2
  <div class="col-md-6 col-xs-12 mx-auto">
3
3
  <div class="card w-75 mx-auto">
4
4
  <div class="card-body">
5
- <%= symphonia_form_for(@model_session, as: :login_session, html: { id: 'login-form' }) do |f| %>
6
- <%= render('form', f: f) %>
5
+ <%= symphonia_form_for(@model_session, as: :login_session, html: { id: "login-form", data: { turbo: false } }) do |f| %>
6
+ <%= render("form", f: f) %>
7
7
  <% end %>
8
8
  </div>
9
9
  </div>
@@ -7,7 +7,6 @@ module Symphonia
7
7
  end
8
8
 
9
9
  included do
10
-
11
10
  before_action :current_user, :menu_item
12
11
  before_action :set_default_locale
13
12
 
@@ -18,13 +17,16 @@ module Symphonia
18
17
 
19
18
  rescue_from ::ActiveRecord::RecordNotFound, with: :render_404
20
19
  rescue_from Unauthorized, CanCan::AccessDenied, with: :render_403
20
+ rescue_from ActionController::InvalidAuthenticityToken do |_exception|
21
+ head :service_unavailable
22
+ end
21
23
 
22
24
  helper_method :current_user, :back_url
23
25
  end
24
26
 
25
27
  def back_url
26
28
  url = params[:back_url].presence
27
- if url.nil? && (referer = request.env['HTTP_REFERER'].presence)
29
+ if url.nil? && (referer = request.env["HTTP_REFERER"].presence)
28
30
  url = CGI.unescape(referer.to_s)
29
31
  end
30
32
  url
@@ -48,7 +50,7 @@ module Symphonia
48
50
  def set_locale
49
51
  params_locale = params.fetch(:locale, nil).presence
50
52
  params_locale ||= session[:locale].presence
51
- params_locale ||= request.env['HTTP_ACCEPT_LANGUAGE'].to_s.split(',').collect { |l| l.scan(/^[a-z]{2}/) }.flatten
53
+ params_locale ||= request.env["HTTP_ACCEPT_LANGUAGE"].to_s.split(",").collect { |l| l.scan(/^[a-z]{2}/) }.flatten
52
54
  client_lang = Array(params_locale).compact
53
55
  client_lang.unshift current_user.language if current_user.language
54
56
  @client_lang = client_lang.detect { |l| I18n.available_locales.include?(l.to_sym) }
@@ -75,7 +77,7 @@ module Symphonia
75
77
  redirect_to symphonia.login_path, flash: { error: t(:text_login_require) }
76
78
  end
77
79
  format.json do
78
- render json: { errors: 'You must be logged in to access this endpoint' }, status: :unauthorized
80
+ render json: { errors: "You must be logged in to access this endpoint" }, status: :unauthorized
79
81
  end
80
82
  format.any { head :unauthorized }
81
83
  end
@@ -89,29 +91,28 @@ module Symphonia
89
91
 
90
92
  def admin_require
91
93
  return unless login_require
94
+ return if current_user.admin?
92
95
 
93
- unless current_user.admin?
94
- render_403
95
- false
96
- end
96
+ render_403
97
+ false
97
98
  end
98
99
 
99
100
  alias require_admin admin_require
100
101
 
101
102
  def render_403
102
103
  respond_to do |format|
103
- format.html { render template: 'common/403', message: :notice_not_authorized, status: :forbidden }
104
+ format.html { render template: "common/403", message: :notice_not_authorized, status: :forbidden }
104
105
  format.js do
105
106
  render plain: "alert('#{t :text_access_deny}')", message: :notice_not_authorized, status: :forbidden
106
107
  end
107
- format.any { head 403, message: :notice_not_authorized }
108
+ format.any { head :forbidden, message: :notice_not_authorized }
108
109
  end
109
110
  end
110
111
 
111
112
  def render_404
112
113
  respond_to do |format|
113
- format.html { render template: 'common/404', message: :notice_page_not_found, status: :not_found }
114
- format.any { head 404, message: :not_found }
114
+ format.html { render template: "common/404", message: :notice_page_not_found, status: :not_found }
115
+ format.any { head :not_found, message: :not_found }
115
116
  end
116
117
  end
117
118
 
@@ -126,7 +127,7 @@ module Symphonia
126
127
  end
127
128
 
128
129
  def menu_item(item = nil)
129
- @menu_item = (item || controller_name)
130
+ @menu_item = item || controller_name
130
131
  end
131
132
 
132
133
  def current_user_session
@@ -153,9 +154,9 @@ module Symphonia
153
154
  return true if current_user&.logged_in? && request.format&.json?
154
155
 
155
156
  current_user_session&.destroy
156
- raise ActionController::InvalidAuthenticityToken
157
+ # raise ActionController::InvalidAuthenticityToken
157
158
 
158
- # redirect_to main_app.root_url
159
+ super
159
160
  end
160
161
 
161
162
  def store_location
@@ -1,5 +1,5 @@
1
1
  module Symphonia
2
2
 
3
- VERSION = '6.0.2'
3
+ VERSION = "6.0.5"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symphonia
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2
4
+ version: 6.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Pokorny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2024-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api-pagination
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: authlogic
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: bootstrap_form
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '4.4'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '4.4'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cancancan
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.1
75
+ version: '0.5'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.3.1
82
+ version: '0.5'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rails-i18n
85
85
  requirement: !ruby/object:Gem::Requirement