hubssolib 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +10 -3
- data/hubssolib.gemspec +1 -1
- data/lib/hub_sso_lib.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff87f5cf7f12fbe119c62700a1967efe14365bd60ac1a9c4be277825320e62eb
|
4
|
+
data.tar.gz: 91a60374a009856c6090365fd711a0ad4a3e1b2d5deceaa845e10d215717fd43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c77c64ac36ca1ddb3b31fd96b0061cb8bb63e4ca512c9ef59fe010fb4917310dcabf1bff99a5b404b7105d6607bd81adfaece9803d4b0f48aa57e861d1084864
|
7
|
+
data.tar.gz: ff31f8a5fb859f35f1c0e777c49127ed02692e00056ef3dd7bfdd74e034066096b89358cc2e834850a84d33d64b7d020edcc0d400648307ad92c6f28f910e682
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 3.2.1, 16-Feb-2025
|
2
|
+
|
3
|
+
The conditional login return-via-referrer mechanism never really worked, so instead have the login status indicator link generate a return-to URL in the query string instead and forward that, if present, in preference.
|
4
|
+
|
1
5
|
## 3.2.0, 15-Feb-2025
|
2
6
|
|
3
7
|
Introduces the user change handler mechanism, a scheme whereby an external application tells Hub about a Rake task that the application has implemented, through which Hub can inform if of changes to a user's e-mail address or "real" name. See the gem's `README.md` for details, under "Applications with an existing user model".
|
data/README.md
CHANGED
@@ -166,7 +166,7 @@ To solve these problems, external applications integrated with Hub can participa
|
|
166
166
|
```ruby
|
167
167
|
module Foo
|
168
168
|
class Application < Rails::Application
|
169
|
-
|
169
|
+
include HubSsoLib::Core
|
170
170
|
|
171
171
|
hubssolib_register_user_change_handler(
|
172
172
|
app_name: Rails.application.name,
|
@@ -187,12 +187,19 @@ For example, `lib/tasks/hub.rake` might look like this:
|
|
187
187
|
namespace :hub do
|
188
188
|
desc 'Update a user with details sent from Hub'
|
189
189
|
task :update_user, [:old_email, :old_name, :new_email, :new_name] => :environment do | t, args |
|
190
|
-
user = User.find_by_email_address(old_email)
|
191
|
-
|
190
|
+
user = User.find_by_email_address(args[:old_email])
|
191
|
+
|
192
|
+
# ...or use "user&.update_columns" for speed and to bypass validations, as
|
193
|
+
# Hub's validations may not be as strict as yours but it doesn't matter if
|
194
|
+
# you're happy syncing Hub data in general.
|
195
|
+
#
|
196
|
+
user&.update!(email_address: args[:new_email], display_name: args[:new_name])
|
192
197
|
end
|
193
198
|
end
|
194
199
|
```
|
195
200
|
|
201
|
+
The four arguments are guaranteed to be present and non-empty, with leading or trailing white space already stripped. You don't need to waste time checking for `nil` or blank values. The upper/lower case **is preserved**, as entered by the user, for all arguments - so e-mail addresses in particular might contain a mixture of upper and lower case letters. If this matters to your application, be sure to apply whatever normalisation you previously used when your user record was originally created with the old Hub-sourced e-mail and/or name.
|
202
|
+
|
196
203
|
|
197
204
|
|
198
205
|
## Hub library API
|
data/hubssolib.gemspec
CHANGED
data/lib/hub_sso_lib.rb
CHANGED
@@ -555,6 +555,15 @@ module HubSsoLib
|
|
555
555
|
noscript_img_src = "#{HUB_PATH_PREFIX}/account/login_indication.png"
|
556
556
|
noscript_img_tag = helpers.image_tag(noscript_img_src, size: '90x22', border: '0', alt: 'Log in or out')
|
557
557
|
|
558
|
+
if self.respond_to?(:request)
|
559
|
+
return_to_url = self.request.try(:original_url)
|
560
|
+
|
561
|
+
if return_to_url.present?
|
562
|
+
return_query = URI.encode_www_form({ return_to_url: return_to_url.to_s })
|
563
|
+
ui_href << "?#{return_query}"
|
564
|
+
end
|
565
|
+
end
|
566
|
+
|
558
567
|
logged_in_link = helpers.link_to('Account', ui_href, id: 'hubssolib_logged_in_link')
|
559
568
|
logged_out_link = helpers.link_to('Log in', ui_href, id: 'hubssolib_logged_out_link')
|
560
569
|
noscript_link = helpers.link_to(noscript_img_tag, ui_href, id: 'hubssolib_login_noscript')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubssolib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hodgkinson and others
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: drb
|