rails_simple_auth 1.0.10 → 1.0.12
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f04d475d2df6bde816e61e77f5d9391ffffc32dec83c9455e8efa361cda163df
|
|
4
|
+
data.tar.gz: 992d4ccd1da760c2fd9527c8237b88e7b382dba22611677f5697c0a92661b470
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4b2d0ee53b6280a1b51ebb29fc7314b8634c684b678c1a425a143be753f5dc308b82689e3179ddb865cdde63a2a657d4c7cbb851bf56f67ce6f1ab1717cd5e4
|
|
7
|
+
data.tar.gz: 1cee554dfa30dd85524754fdf2c04dd6aedb8d93912171951e3c4e018a81d3de4779fe42fa6567f28a9323040f41c406b59bccc71eb05b543e53073c7a36d29f
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.12] - 2026-01-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **OAuth view helper** - Simple `oauth_display_name(provider)` helper for views
|
|
15
|
+
```erb
|
|
16
|
+
Continue with <%= oauth_display_name(provider) %>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## [1.0.11] - 2026-01-19
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **OAuth provider display names** - Configure human-readable names for OAuth buttons
|
|
24
|
+
```ruby
|
|
25
|
+
# Hash format with custom display names
|
|
26
|
+
config.enable_oauth(google_oauth2: "Google", github: "GitHub")
|
|
27
|
+
|
|
28
|
+
# Symbol format still works (backward compatible)
|
|
29
|
+
config.enable_oauth(:google_oauth2, :github)
|
|
30
|
+
```
|
|
31
|
+
- `oauth_provider_display_name(provider)` method returns the display name, falling back to titleized provider name with `_oauth2` suffix removed
|
|
32
|
+
|
|
10
33
|
## [1.0.10] - 2026-01-19
|
|
11
34
|
|
|
12
35
|
### Fixed
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsSimpleAuth
|
|
4
|
+
module OauthHelper
|
|
5
|
+
# Get display name for an OAuth provider
|
|
6
|
+
# Usage: oauth_display_name(:google_oauth2) => "Google"
|
|
7
|
+
def oauth_display_name(provider)
|
|
8
|
+
RailsSimpleAuth.configuration.oauth_provider_display_name(provider)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module RailsSimpleAuth
|
|
4
4
|
class Configuration
|
|
5
|
-
attr_accessor :magic_link_enabled, :email_confirmation_enabled, :oauth_enabled, :oauth_providers, :oauth_link_existing_accounts,
|
|
5
|
+
attr_accessor :magic_link_enabled, :email_confirmation_enabled, :oauth_enabled, :oauth_providers, :oauth_provider_names, :oauth_link_existing_accounts,
|
|
6
6
|
:magic_link_expiry, :password_reset_expiry, :confirmation_expiry, :session_expiry,
|
|
7
7
|
:rate_limits,
|
|
8
8
|
:after_sign_in_path, :after_sign_out_path, :after_sign_up_path, :after_confirmation_path,
|
|
@@ -20,6 +20,7 @@ module RailsSimpleAuth
|
|
|
20
20
|
@email_confirmation_enabled = true
|
|
21
21
|
@oauth_enabled = false
|
|
22
22
|
@oauth_providers = []
|
|
23
|
+
@oauth_provider_names = {}
|
|
23
24
|
@oauth_link_existing_accounts = true # Allow OAuth to link to existing email accounts
|
|
24
25
|
|
|
25
26
|
@magic_link_expiry = 15.minutes
|
|
@@ -87,15 +88,36 @@ module RailsSimpleAuth
|
|
|
87
88
|
"Original error: #{e.message}"
|
|
88
89
|
end
|
|
89
90
|
|
|
91
|
+
# Enable OAuth providers with optional display names
|
|
92
|
+
# Usage:
|
|
93
|
+
# enable_oauth(:google_oauth2, :github) # Uses default display names
|
|
94
|
+
# enable_oauth(google_oauth2: "Google", github: "GitHub") # Custom display names
|
|
90
95
|
def enable_oauth(*providers)
|
|
91
96
|
self.oauth_enabled = true
|
|
92
|
-
|
|
97
|
+
|
|
98
|
+
if providers.length == 1 && providers.first.is_a?(Hash)
|
|
99
|
+
# Hash format: { google_oauth2: "Google", github: "GitHub" }
|
|
100
|
+
provider_hash = providers.first
|
|
101
|
+
self.oauth_providers = provider_hash.keys.map(&:to_sym)
|
|
102
|
+
self.oauth_provider_names = provider_hash.transform_keys(&:to_sym)
|
|
103
|
+
else
|
|
104
|
+
# Symbol format: :google_oauth2, :github (backward compatible)
|
|
105
|
+
self.oauth_providers = providers.map(&:to_sym)
|
|
106
|
+
self.oauth_provider_names = {}
|
|
107
|
+
end
|
|
93
108
|
end
|
|
94
109
|
|
|
95
110
|
def oauth_provider_enabled?(provider)
|
|
96
111
|
oauth_enabled && oauth_providers.include?(provider.to_sym)
|
|
97
112
|
end
|
|
98
113
|
|
|
114
|
+
# Get display name for an OAuth provider
|
|
115
|
+
# Falls back to titleized provider name if no custom name is configured
|
|
116
|
+
def oauth_provider_display_name(provider)
|
|
117
|
+
provider_sym = provider.to_sym
|
|
118
|
+
oauth_provider_names[provider_sym] || provider.to_s.gsub(/_oauth2$/, "").titleize
|
|
119
|
+
end
|
|
120
|
+
|
|
99
121
|
def rate_limit_for(action)
|
|
100
122
|
rate_limits&.dig(action.to_sym)
|
|
101
123
|
end
|
|
@@ -15,6 +15,10 @@ module RailsSimpleAuth
|
|
|
15
15
|
include RailsSimpleAuth::Controllers::Concerns::Authentication
|
|
16
16
|
include RailsSimpleAuth::Controllers::Concerns::SessionManagement
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
ActiveSupport.on_load(:action_view) do
|
|
20
|
+
include RailsSimpleAuth::OauthHelper
|
|
21
|
+
end
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
initializer 'rails_simple_auth.model' do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_simple_auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ivan Kuznetsov
|
|
@@ -57,6 +57,7 @@ files:
|
|
|
57
57
|
- app/controllers/rails_simple_auth/passwords_controller.rb
|
|
58
58
|
- app/controllers/rails_simple_auth/registrations_controller.rb
|
|
59
59
|
- app/controllers/rails_simple_auth/sessions_controller.rb
|
|
60
|
+
- app/helpers/rails_simple_auth/oauth_helper.rb
|
|
60
61
|
- app/mailers/rails_simple_auth/auth_mailer.rb
|
|
61
62
|
- app/views/layouts/rails_simple_auth.html.erb
|
|
62
63
|
- app/views/rails_simple_auth/confirmations/new.html.erb
|