bpluser 0.3.0 → 0.5.0
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 +4 -4
- data/README.md +42 -3
- data/app/controllers/bookmarks_controller.rb +1 -1
- data/app/controllers/concerns/bpluser/registrations.rb +22 -6
- data/app/views/devise/registrations/new.html.erb +5 -0
- data/app/views/folders/show.html.erb +1 -1
- data/config/locales/bpluser.en.yml +4 -0
- data/lib/bpluser/engine.rb +6 -0
- data/lib/bpluser/version.rb +1 -1
- data/lib/generators/bpluser/install_generator.rb +4 -0
- data/lib/generators/bpluser/templates/config/initializers/recaptcha.rb +6 -0
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd649e2a92743c6ccfba60658937a9f8875e852fdb0d69ab4e492b3847c0da0c
|
4
|
+
data.tar.gz: cb75d8272d9c0a349420742b3387b6a0c9c34a4543dc506da9ce15cf6b3a97cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f409d0f76f047bd5183e70efdea64a82b13a8c3f34cf5bf70531985fc8794a3fe0fce0c663e7aa6f9b03af759c356ba0d218f9c68b1fe9f6269ca4af318fd8
|
7
|
+
data.tar.gz: fe4199c4dcb0a8f152697d878924237968004e96490dcc47df0d793f00b97686aa02adb4c44040b03b134c095cd35fa2acbbe6a6fe0a0d79b757244d22ae064b
|
data/README.md
CHANGED
@@ -8,13 +8,13 @@ Rails engine for providing Devise-based user models and functionality for digita
|
|
8
8
|
This includes bookmarks (Blacklight default), custom folders, and saved searches.
|
9
9
|
|
10
10
|
# Requirements
|
11
|
-
- `ruby >=
|
12
|
-
- `rails ~> 6.
|
11
|
+
- `ruby >= 3.1, < 3.2`
|
12
|
+
- `rails ~> 6.1.7`
|
13
13
|
- `postgres v12 or higher`
|
14
14
|
|
15
15
|
To install, add the following to your Gemfile:
|
16
16
|
```ruby
|
17
|
-
gem 'bpluser', '~> 0.
|
17
|
+
gem 'bpluser', '~> 0.5.0'
|
18
18
|
# OR
|
19
19
|
gem 'bpluser', git: 'https://github.com/boston-library/bpluser'
|
20
20
|
```
|
@@ -31,3 +31,42 @@ rails bpluser:install:update_migrations
|
|
31
31
|
```
|
32
32
|
|
33
33
|
(Note that the installer will ask to overwrite your local `config/locales/devise.en.yml`).
|
34
|
+
|
35
|
+
### Local development
|
36
|
+
|
37
|
+
In one console, start Solr from project root:
|
38
|
+
```
|
39
|
+
$ solr_wrapper --config .solr_wrapper.yml
|
40
|
+
```
|
41
|
+
In a second console, index the sample Solr documents (run from `./spec/dummy`):
|
42
|
+
```
|
43
|
+
# Solr must be running
|
44
|
+
$ bundle exec rake bpluser:test_index:seed
|
45
|
+
```
|
46
|
+
Run the migrations and start the app (in second console, run from `./spec/dummy`):
|
47
|
+
```
|
48
|
+
bundle exec rake db:create
|
49
|
+
bundle exec rake db:migrate
|
50
|
+
rails s
|
51
|
+
# app should be accessible at 127.0.0.1:3000
|
52
|
+
```
|
53
|
+
|
54
|
+
### Running tests
|
55
|
+
|
56
|
+
Start Solr from project root:
|
57
|
+
```
|
58
|
+
$ solr_wrapper --config .solr_wrapper_test.yml
|
59
|
+
```
|
60
|
+
Index the sample Solr documents (run from `./spec/dummy`):
|
61
|
+
```
|
62
|
+
# Solr must be running
|
63
|
+
$ RAILS_ENV=test bundle exec rake bpluser:test_index:seed
|
64
|
+
```
|
65
|
+
Run specs
|
66
|
+
```
|
67
|
+
# run all tests
|
68
|
+
$ bundle exec rake spec
|
69
|
+
|
70
|
+
# run a single spec
|
71
|
+
$ bundle exec rake spec SPEC=./spec/models/some_model_spec.rb
|
72
|
+
```
|
@@ -22,7 +22,7 @@ class BookmarksController < CatalogController
|
|
22
22
|
|
23
23
|
if request.xhr?
|
24
24
|
# success ? render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count }}) : render(:text => "", :status => "500")
|
25
|
-
success ? render(:update) : render(plain: '', status:
|
25
|
+
success ? render(:update) : render(plain: '', status: :internal_server_error)
|
26
26
|
else
|
27
27
|
if @bookmarks.any? && success
|
28
28
|
flash[:notice] = I18n.t('blacklight.bookmarks.add.success', count: @bookmarks.count)
|
@@ -10,14 +10,30 @@ module Bpluser
|
|
10
10
|
end
|
11
11
|
|
12
12
|
module InstanceMethods
|
13
|
-
#
|
13
|
+
# override #create from Devise::RegistrationsController to add verify_captcha and logic for error handling
|
14
|
+
# this is the best way to preserve and re-render any submitted params when verify_recaptcha fails
|
14
15
|
def create
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
16
|
+
build_resource(sign_up_params)
|
17
|
+
|
18
|
+
resource.save if verify_recaptcha
|
19
19
|
|
20
|
-
|
20
|
+
yield resource if block_given?
|
21
|
+
if resource.persisted?
|
22
|
+
if resource.active_for_authentication?
|
23
|
+
set_flash_message! :notice, :signed_up
|
24
|
+
sign_up(resource_name, resource)
|
25
|
+
respond_with resource, location: after_sign_up_path_for(resource)
|
26
|
+
else
|
27
|
+
set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
|
28
|
+
expire_data_after_sign_in!
|
29
|
+
respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
30
|
+
end
|
31
|
+
else
|
32
|
+
resource.errors.add(:errors, message: t('devise.registrations.recaptcha_error')) unless verify_recaptcha
|
33
|
+
clean_up_passwords resource
|
34
|
+
set_minimum_password_length
|
35
|
+
respond_with resource
|
36
|
+
end
|
21
37
|
end
|
22
38
|
|
23
39
|
protected
|
@@ -34,6 +34,11 @@
|
|
34
34
|
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
|
+
<div class="form-group row">
|
38
|
+
<div class="offset-sm-2 col-sm-4">
|
39
|
+
<%= recaptcha_tags(id: 'registrations_recaptcha') %>
|
40
|
+
</div>
|
41
|
+
</div>
|
37
42
|
<div class="form-group row">
|
38
43
|
<div class="offset-sm-2 col-sm-4">
|
39
44
|
<%= f.submit 'Sign up', class: 'btn btn-primary' %>
|
data/lib/bpluser/engine.rb
CHANGED
data/lib/bpluser/version.rb
CHANGED
@@ -0,0 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Recaptcha.configure do |config|
|
4
|
+
config.site_key = ENV.fetch('RECAPTCHA_SITE_KEY') { Rails.application.credentials[:recaptcha_site_key] }
|
5
|
+
config.secret_key = ENV.fetch('RECAPTCHA_SECRET_KEY') { Rails.application.credentials[:recaptcha_secret_key] }
|
6
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bpluser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boston Public Library Repository Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 6.1.7.4
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: recaptcha
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '5.12'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '5.12'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: awesome_print
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,6 +280,7 @@ files:
|
|
266
280
|
- lib/generators/bpluser/devise_generator.rb
|
267
281
|
- lib/generators/bpluser/install_generator.rb
|
268
282
|
- lib/generators/bpluser/templates/config/initializers/devise.rb.bak
|
283
|
+
- lib/generators/bpluser/templates/config/initializers/recaptcha.rb
|
269
284
|
- lib/generators/bpluser/templates/config/locales/devise.en.yml
|
270
285
|
- lib/generators/bpluser/templates/config/omniauth-polaris.yml
|
271
286
|
- lib/generators/bpluser/templates/models/user.rb
|
@@ -283,17 +298,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
283
298
|
requirements:
|
284
299
|
- - ">="
|
285
300
|
- !ruby/object:Gem::Version
|
286
|
-
version: 3.
|
301
|
+
version: '3.1'
|
287
302
|
- - "<"
|
288
303
|
- !ruby/object:Gem::Version
|
289
|
-
version: '3.
|
304
|
+
version: '3.2'
|
290
305
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
306
|
requirements:
|
292
307
|
- - ">="
|
293
308
|
- !ruby/object:Gem::Version
|
294
309
|
version: '0'
|
295
310
|
requirements: []
|
296
|
-
rubygems_version: 3.
|
311
|
+
rubygems_version: 3.3.27
|
297
312
|
signing_key:
|
298
313
|
specification_version: 4
|
299
314
|
summary: Shared user access gem for public front ends
|