alchemy-devise 6.0.0 → 6.2.0

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: ac9f1d9cb0e0ae6c8785fae335c084f35bc99fd57f0f0ecb8fbb69af31a0acf8
4
- data.tar.gz: 7a25e4e8233588c7daaeded0550cfe16c01d529f32e8f20c5319afd62a8d2f3a
3
+ metadata.gz: 037e618a3f66b84599f6e3dd9c9ee7ac2b5eccafad82df24e7a2deac4e277cfc
4
+ data.tar.gz: 8bc2d3e03a28e5a570aace97412aae02055f6ba2fdfa3730598749081bcac8d8
5
5
  SHA512:
6
- metadata.gz: aef2756070f8c8316ee71ff1d14c3c01f9d00864f4f57178bbf4261552cf69e95c9e3e453a4ae2841557a2c8633bdaf2979d9eaf9149bbaac341098be3e07a92
7
- data.tar.gz: 2dc752cea79c75090d0bea21c409eba342e135a08a9f0d17bd547e12fdbc557b1e68b27379fd41130294f1bc83df738da13a9a02390a4b6d8d51eaf77ee87380
6
+ metadata.gz: c577818f7db36c4a5bd4147f878ef8a63d511fdd42573e97b54212742e6aaafe960ad039b8cfb7ce90683f240c385508b881d070240c70e1bb1704b7ad754725
7
+ data.tar.gz: db8f25a255b6b700b414d7ca0b154f3fd35de04941e5e286cfee2069c2630670532aab28e56d6a925427fe3ce8f0d55ba5faa265d7815e5a00b989e98e933fd6
data/CHANGELOG.md ADDED
@@ -0,0 +1,93 @@
1
+ # Changelog
2
+
3
+ ## 6.2.0 (2023-04-01)
4
+
5
+ - Add Alchemy 7 support [#164](https://github.com/AlchemyCMS/alchemy-devise/pull/164) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Upgrade rspec-rails to version 6.0.1 [#153](https://github.com/AlchemyCMS/alchemy-devise/pull/153) ([depfu](https://github.com/apps/depfu))
7
+
8
+ ## 6.1.0 (2023-01-20)
9
+
10
+ - Remove Alchemy 5.3 support [#158](https://github.com/AlchemyCMS/alchemy-devise/pull/158) ([tvdeyen](https://github.com/tvdeyen))
11
+ - Update gemspec to Alchemy below 7.0 [#156](https://github.com/AlchemyCMS/alchemy-devise/pull/156) ([kulturbande](https://github.com/kulturbande))
12
+ - use code climate gh action [#147](https://github.com/AlchemyCMS/alchemy-devise/pull/147) ([tvdeyen](https://github.com/tvdeyen))
13
+ - Upgrade rspec-rails to version 5.1.2 [#138](https://github.com/AlchemyCMS/alchemy-devise/pull/138) ([depfu](https://github.com/apps/depfu))
14
+
15
+ ## 6.0.0 (2022-04-24)
16
+
17
+ - Alchemy 6 compatibility [#137](https://github.com/AlchemyCMS/alchemy-devise/pull/137) ([tvdeyen](https://github.com/tvdeyen))
18
+ - Use minor versions for Ruby in CI [#131](https://github.com/AlchemyCMS/alchemy-devise/pull/131) ([mamhoff](https://github.com/mamhoff))
19
+ - Migrate to GH actions as CI [#122](https://github.com/AlchemyCMS/alchemy-devise/pull/122) ([tvdeyen](https://github.com/tvdeyen))
20
+ - Allow Alchemy 6 [#119](https://github.com/AlchemyCMS/alchemy-devise/pull/119) ([tvdeyen](https://github.com/tvdeyen))
21
+
22
+ ## 5.1.0 (2021-01-13)
23
+
24
+ - Remove support for old Alchemy versions [#118](https://github.com/AlchemyCMS/alchemy-devise/pull/118) ([tvdeyen](https://github.com/tvdeyen))
25
+ - Admin users list fixes [#117](https://github.com/AlchemyCMS/alchemy-devise/pull/117) ([tvdeyen](https://github.com/tvdeyen))
26
+ - Use Alchemy::User as class in ability [#116](https://github.com/AlchemyCMS/alchemy-devise/pull/116) ([tvdeyen](https://github.com/tvdeyen))
27
+ - Fixate sassc gem to 2.1.0 [#115](https://github.com/AlchemyCMS/alchemy-devise/pull/115) ([tvdeyen](https://github.com/tvdeyen))
28
+ - Use content_for :toolbar instead of toolbar [#114](https://github.com/AlchemyCMS/alchemy-devise/pull/114) ([tvdeyen](https://github.com/tvdeyen))
29
+
30
+ ## 5.0.1 (2020-11-22)
31
+
32
+ - Require alchemy/version in controllers using ssl_required [#113](https://github.com/AlchemyCMS/alchemy-devise/pull/113) ([tvdeyen](https://github.com/tvdeyen))
33
+ - Use absolute paths in Alchemy module definition [#106](https://github.com/AlchemyCMS/alchemy-devise/pull/106) ([tvdeyen](https://github.com/tvdeyen))
34
+
35
+ ## 4.6.0 (2020-10-16)
36
+
37
+ - Remove require_ssl from User Sessions Controller for Alchemy 5+ [#102](https://github.com/AlchemyCMS/alchemy-devise/pull/102) ([mamhoff](https://github.com/mamhoff))
38
+
39
+ ## 4.5.0 (2020-04-04)
40
+
41
+ - Remove alchemy controller requests test helper [#100](https://github.com/AlchemyCMS/alchemy-devise/pull/100) ([tvdeyen](https://github.com/tvdeyen))
42
+ - Move session controllers into admin module namespace [#97](https://github.com/AlchemyCMS/alchemy-devise/pull/97) ([tvdeyen](https://github.com/tvdeyen))
43
+
44
+ ## 4.4.0 (2019-01-09)
45
+
46
+ - Set Alchemy.logout_method to Devise.sign_out_via [#96](https://github.com/AlchemyCMS/alchemy-devise/pull/96) ([tvdeyen](https://github.com/tvdeyen))
47
+ - Allow Alchemy 5.0 [#95](https://github.com/AlchemyCMS/alchemy-devise/pull/95) ([tvdeyen](https://github.com/tvdeyen))
48
+ - Remove gender [#94](https://github.com/AlchemyCMS/alchemy-devise/pull/94) ([rmparr](https://github.com/rmparr))
49
+
50
+ ## 4.3.1 (2019-11-28)
51
+
52
+ - add config/manifest.js to dummy app [#93](https://github.com/AlchemyCMS/alchemy-devise/pull/93) ([rmparr](https://github.com/rmparr))
53
+ - Use at least Devise 4.7.1 [#90](https://github.com/AlchemyCMS/alchemy-devise/pull/90) ([tvdeyen](https://github.com/tvdeyen))
54
+ - Rename Alchemy::BaseController extension constant [#87](https://github.com/AlchemyCMS/alchemy-devise/pull/87) ([tvdeyen](https://github.com/tvdeyen))
55
+
56
+ ## 4.3.0 (2019-08-23)
57
+
58
+ - Move test dependencies [#86](https://github.com/AlchemyCMS/alchemy-devise/pull/86) ([tvdeyen](https://github.com/tvdeyen))
59
+ - Test with Rails 6 [#85](https://github.com/AlchemyCMS/alchemy-devise/pull/85) ([tvdeyen](https://github.com/tvdeyen))
60
+
61
+ ## 4.2.1 (2019-05-15)
62
+
63
+ - Remove test files from built Ruby gem [#82](https://github.com/AlchemyCMS/alchemy-devise/pull/82) ([tvdeyen](https://github.com/tvdeyen))
64
+ - Run CSRF protection before all other controller filters [#81](https://github.com/AlchemyCMS/alchemy-devise/pull/81) ([tvdeyen](https://github.com/tvdeyen))
65
+
66
+ ## 4.2.0 (2019-04-01)
67
+
68
+ - Do not store screen size at login [#78](https://github.com/AlchemyCMS/alchemy-devise/pull/78) ([tvdeyen](https://github.com/tvdeyen))
69
+ - Security: Use at least Devise 4.6 [#78](https://github.com/AlchemyCMS/alchemy-devise/pull/78) ([tvdeyen](https://github.com/tvdeyen))
70
+ - Fix dummy app rails version [#76](https://github.com/AlchemyCMS/alchemy-devise/pull/76) ([tvdeyen](https://github.com/tvdeyen))
71
+ - Fix translation key on user admin page [#75](https://github.com/AlchemyCMS/alchemy-devise/pull/75) ([mamhoff](https://github.com/mamhoff))
72
+
73
+
74
+ ## 4.1.0 (2018-09-22)
75
+
76
+ - Only allow Alchemy > 4.1 [#72](https://github.com/AlchemyCMS/alchemy-devise/pull/72) ([tvdeyen](https://github.com/tvdeyen))
77
+ - Upgrade dummy app rails version to 5.2.1 [#71](https://github.com/AlchemyCMS/alchemy-devise/pull/71) ([depfu](https://github.com/marketplace/depfu))
78
+ - Build for Rails 5.1 [#70](https://github.com/AlchemyCMS/alchemy-devise/pull/70) ([tvdeyen](https://github.com/tvdeyen))
79
+ - Fixes localization specs [#69](https://github.com/AlchemyCMS/alchemy-devise/pull/69) ([tvdeyen](https://github.com/tvdeyen))
80
+ - Removes translations [#68](https://github.com/AlchemyCMS/alchemy-devise/pull/68) ([tvdeyen](https://github.com/tvdeyen))
81
+ - New login screen that fit the new color theme [#67](https://github.com/AlchemyCMS/alchemy-devise/pull/67) ([tvdeyen](https://github.com/tvdeyen))
82
+ - Use Alchemy's Taggable module [#66](https://github.com/AlchemyCMS/alchemy-devise/pull/66) ([tvdeyen](https://github.com/tvdeyen))
83
+ - Upgrade pg to version 1.0.0 [#65](https://github.com/AlchemyCMS/alchemy-devise/pull/65) ([depfu](https://github.com/marketplace/depfu))
84
+ - FontAwesome icons [#64](https://github.com/AlchemyCMS/alchemy-devise/pull/64) ([tvdeyen](https://github.com/tvdeyen))
85
+ - Fix postgresql builds [#63](https://github.com/AlchemyCMS/alchemy-devise/pull/63) ([tvdeyen](https://github.com/tvdeyen))
86
+
87
+ ## 4.0.0 (2017-11-06)
88
+
89
+ - Update dummy app layout for Alchemy 4.0 [#62](https://github.com/AlchemyCMS/alchemy-devise/pull/62) ([tvdeyen](https://github.com/tvdeyen))
90
+ - Alchemy 4.0 [#61](https://github.com/AlchemyCMS/alchemy-devise/pull/61) ([tvdeyen](https://github.com/tvdeyen))
91
+ - Send code coverage results after successful build [#60](https://github.com/AlchemyCMS/alchemy-devise/pull/60) ([tvdeyen](https://github.com/tvdeyen))
92
+ - Allow to configure devise modules [#59](https://github.com/AlchemyCMS/alchemy-devise/pull/59) ([tvdeyen](https://github.com/tvdeyen))
93
+ - Rails 5, Alchemy 4, Devise 4 [#58](https://github.com/AlchemyCMS/alchemy-devise/pull/58) ([tvdeyen](https://github.com/tvdeyen))
@@ -7,10 +7,6 @@ module Alchemy
7
7
  class PasswordsController < ::Devise::PasswordsController
8
8
  include Alchemy::Admin::Locale
9
9
 
10
- if Alchemy.gem_version <= Gem::Version.new("4.9")
11
- before_action { enforce_ssl if ssl_required? && !request.ssl? }
12
- end
13
-
14
10
  helper "Alchemy::Admin::Base"
15
11
 
16
12
  layout "alchemy/admin"
@@ -9,11 +9,6 @@ module Alchemy
9
9
 
10
10
  protect_from_forgery prepend: true
11
11
 
12
- if Alchemy.gem_version <= Gem::Version.new("4.9")
13
- before_action except: "destroy" do
14
- enforce_ssl if ssl_required? && !request.ssl?
15
- end
16
- end
17
12
  before_action :check_user_count, :only => :new
18
13
 
19
14
  helper "Alchemy::Admin::Base"
@@ -1,5 +1,7 @@
1
- require 'devise/orm/active_record'
2
- require 'userstamp'
1
+ # frozen_string_literal: true
2
+
3
+ require "devise/orm/active_record"
4
+ require "userstamp"
3
5
 
4
6
  module Alchemy
5
7
  class User < ActiveRecord::Base
@@ -12,7 +14,7 @@ module Alchemy
12
14
  :password,
13
15
  :password_confirmation,
14
16
  :send_credentials,
15
- :tag_list
17
+ :tag_list,
16
18
  ]
17
19
 
18
20
  devise *Alchemy.devise_modules
@@ -29,13 +31,31 @@ module Alchemy
29
31
  # Unlock all locked pages before destroy.
30
32
  before_destroy :unlock_pages!
31
33
 
32
- scope :admins, -> { where(arel_table[:alchemy_roles].matches('%admin%')) }
33
- scope :logged_in, -> { where('last_request_at > ?', logged_in_timeout.seconds.ago) }
34
- scope :logged_out, -> { where('last_request_at is NULL or last_request_at <= ?', logged_in_timeout.seconds.ago) }
34
+ scope :admins, -> { where(arel_table[:alchemy_roles].matches("%admin%")) }
35
+ scope :logged_in, -> { where("last_request_at > ?", logged_in_timeout.seconds.ago) }
36
+ scope :logged_out, -> { where("last_request_at is NULL or last_request_at <= ?", logged_in_timeout.seconds.ago) }
35
37
 
36
38
  ROLES = Config.get(:user_roles)
37
39
 
38
40
  class << self
41
+ def ransackable_attributes(_auth_object = nil)
42
+ %w[
43
+ email
44
+ firstname
45
+ lastname
46
+ login
47
+ ]
48
+ end
49
+
50
+ alias_method :searchable_alchemy_resource_attributes, :ransackable_attributes
51
+
52
+ def ransackable_associations(_auth_object = nil)
53
+ %w[
54
+ taggings
55
+ tags
56
+ ]
57
+ end
58
+
39
59
  def human_rolename(role)
40
60
  Alchemy.t("user_roles.#{role}")
41
61
  end
@@ -43,19 +63,6 @@ module Alchemy
43
63
  def logged_in_timeout
44
64
  Config.get(:auto_logout_time).minutes.to_i
45
65
  end
46
-
47
- # Search users that match query
48
- #
49
- # Attributes searched are: login, email, firstname, lastname
50
- #
51
- def search(query)
52
- query = "%#{query.downcase}%"
53
-
54
- where arel_table[:login].lower.matches(query)
55
- .or arel_table[:email].lower.matches(query)
56
- .or arel_table[:firstname].lower.matches(query)
57
- .or arel_table[:lastname].lower.matches(query)
58
- end
59
66
  end
60
67
 
61
68
  def role_symbols
@@ -67,12 +74,12 @@ module Alchemy
67
74
  end
68
75
 
69
76
  def alchemy_roles
70
- read_attribute(:alchemy_roles).split(' ')
77
+ read_attribute(:alchemy_roles).split(" ")
71
78
  end
72
79
 
73
80
  def alchemy_roles=(roles_string)
74
81
  if roles_string.is_a? Array
75
- write_attribute(:alchemy_roles, roles_string.join(' '))
82
+ write_attribute(:alchemy_roles, roles_string.join(" "))
76
83
  elsif roles_string.is_a? String
77
84
  write_attribute(:alchemy_roles, roles_string)
78
85
  end
@@ -84,8 +91,9 @@ module Alchemy
84
91
 
85
92
  # Returns true if the user ahs admin role
86
93
  def is_admin?
87
- has_role? 'admin'
94
+ has_role? "admin"
88
95
  end
96
+
89
97
  alias_method :admin?, :is_admin?
90
98
 
91
99
  # Returns true if the user has the given role.
@@ -105,6 +113,7 @@ module Alchemy
105
113
  def pages_locked_by_me
106
114
  Page.locked_by(self).order(:updated_at)
107
115
  end
116
+
108
117
  alias_method :locked_pages, :pages_locked_by_me
109
118
 
110
119
  # Returns the firstname and lastname as a string
@@ -118,11 +127,12 @@ module Alchemy
118
127
  if lastname.blank? && firstname.blank?
119
128
  login
120
129
  else
121
- options = {:flipped => false}.merge(options)
130
+ options = { flipped: false }.merge(options)
122
131
  fullname = options[:flipped] ? "#{lastname}, #{firstname}" : "#{firstname} #{lastname}"
123
132
  fullname.squeeze(" ").strip
124
133
  end
125
134
  end
135
+
126
136
  alias_method :name, :fullname
127
137
  alias_method :alchemy_display_name, :fullname
128
138
 
@@ -150,7 +160,7 @@ module Alchemy
150
160
  # Delivers a welcome mail depending from user's role.
151
161
  #
152
162
  def deliver_welcome_mail
153
- if has_role?('author') || has_role?('editor') || has_role?('admin')
163
+ if has_role?("author") || has_role?("editor") || has_role?("admin")
154
164
  Notifications.alchemy_user_created(self).deliver_later
155
165
  else
156
166
  Notifications.member_created(self).deliver_later
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Devise
3
- VERSION = "6.0.0"
3
+ VERSION = "6.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-24 00:00:00.000000000 Z
11
+ date: 2023-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0
19
+ version: 6.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.1'
22
+ version: '8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 5.0.0
29
+ version: 6.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.1'
32
+ version: '8'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: devise
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -112,14 +112,14 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 4.0.0.beta2
115
+ version: 6.0.1
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: 4.0.0.beta2
122
+ version: 6.0.1
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: simplecov
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -141,9 +141,9 @@ executables: []
141
141
  extensions: []
142
142
  extra_rdoc_files: []
143
143
  files:
144
+ - CHANGELOG.md
144
145
  - LICENSE
145
146
  - README.md
146
- - Rakefile
147
147
  - app/assets/stylesheets/alchemy-devise.scss
148
148
  - app/assets/stylesheets/alchemy-devise/login.scss
149
149
  - app/assets/stylesheets/alchemy-devise/users.scss
@@ -188,7 +188,7 @@ files:
188
188
  - lib/alchemy/devise/version.rb
189
189
  - lib/generators/alchemy/devise/install/install_generator.rb
190
190
  - lib/generators/alchemy/devise/install/templates/devise.rb.tt
191
- homepage: http://alchemy-cms.com
191
+ homepage: https://alchemy-cms.com
192
192
  licenses: []
193
193
  metadata: {}
194
194
  post_install_message: |+
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.1.6
213
+ rubygems_version: 3.4.10
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Devise based user authentication for AlchemyCMS.
data/Rakefile DELETED
@@ -1,64 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'AlchemyDevise'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- rdoc.rdoc_files.include('app/**/*.rb')
16
- end
17
-
18
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
19
- load 'rails/tasks/engine.rake'
20
-
21
- require 'rspec/core/rake_task'
22
-
23
- RSpec::Core::RakeTask.new(:spec)
24
-
25
- task :default => ['alchemy:spec:prepare', :spec]
26
-
27
- Bundler::GemHelper.install_tasks
28
-
29
- namespace :alchemy do
30
- namespace :spec do
31
- desc "Prepares database for testing Alchemy"
32
- task :prepare do
33
- system <<-BASH
34
- cd spec/dummy
35
- export RAILS_ENV=test
36
- bin/rake railties:install:migrations
37
- bin/rake db:drop db:create db:migrate
38
- bin/rails g alchemy:install --force --auto-accept
39
- bin/rails g alchemy:devise:install --force
40
- cd -
41
- BASH
42
- end
43
- end
44
-
45
- namespace :changelog do
46
- desc "Update changelog"
47
- task :update do
48
- original_file = './CHANGELOG.md'
49
- new_file = original_file + '.new'
50
- backup = original_file + '.old'
51
- changes = `git rev-list v#{ENV['PREVIOUS_VERSION']}...main | bundle exec github_fast_changelog AlchemyCMS/alchemy-devise`
52
- File.open(new_file, 'w') do |fo|
53
- fo.puts changes
54
- File.foreach(original_file) do |li|
55
- fo.puts li
56
- end
57
- fo.puts ""
58
- end
59
- File.rename(original_file, backup)
60
- File.rename(new_file, original_file)
61
- File.delete(backup)
62
- end
63
- end
64
- end