aha_builder_core 1.0.7 → 1.0.9
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 +5 -2
- data/lib/aha/auth/version.rb +1 -1
- data/lib/generators/aha_builder_core/auth/auth_generator.rb +5 -3
- data/lib/generators/aha_builder_core/auth/templates/migration.rb.tt +1 -0
- data/lib/generators/aha_builder_core/auth/templates/sessions_controller.rb.tt +3 -2
- 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: 59c37cc872aac2e85b4306ec7f5e737283471d3469ad9718d9c0d838ef9751fd
|
|
4
|
+
data.tar.gz: 0d39ece5b2491709ca26ef2959ea227b6ff1d16292387adfcea3ec802cf45011
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec8d2a196f8f8c82c5f0ca833d68f1ed1b16fbf3da9954d9c0bf1e81c4033f2516712477f265a0d42283aa4e263bc31809963d1624a0c965753081c4a0221bfe
|
|
7
|
+
data.tar.gz: fb82aff0a32374f547d081a70acf20ef993a679e08b66186456c0e8910f918a1bf20a2ee8aa58e7e842e8ca03a6021af8553bcda94cf56851115049278d029dc
|
data/README.md
CHANGED
|
@@ -48,7 +48,8 @@ result = Aha::Auth.authenticate_with_code(code: params[:code])
|
|
|
48
48
|
# first_name: "Jane",
|
|
49
49
|
# last_name: "Doe",
|
|
50
50
|
# email: "jane.doe@example.com",
|
|
51
|
-
# email_verified: true
|
|
51
|
+
# email_verified: true,
|
|
52
|
+
# avatar_url: "https://example.com/avatar.jpg"
|
|
52
53
|
# }
|
|
53
54
|
# }
|
|
54
55
|
```
|
|
@@ -62,6 +63,7 @@ The `user` object returned contains the authenticated user's profile information
|
|
|
62
63
|
- `last_name`: User's last name. last_name is optional and may not be present.
|
|
63
64
|
- `email`: User's email address
|
|
64
65
|
- `email_verified`: Boolean indicating if the email has been verified
|
|
66
|
+
- `avatar_url`: URL to the user's avatar image (may be nil if not available from the identity provider)
|
|
65
67
|
|
|
66
68
|
#### Linking to Local User Records
|
|
67
69
|
|
|
@@ -79,7 +81,8 @@ local_user.update!(
|
|
|
79
81
|
email: result[:user][:email],
|
|
80
82
|
first_name: result[:user][:first_name],
|
|
81
83
|
last_name: result[:user][:last_name],
|
|
82
|
-
email_verified: result[:user][:email_verified]
|
|
84
|
+
email_verified: result[:user][:email_verified],
|
|
85
|
+
avatar_url: result[:user][:avatar_url]
|
|
83
86
|
)
|
|
84
87
|
|
|
85
88
|
# Store tokens in session or database
|
data/lib/aha/auth/version.rb
CHANGED
|
@@ -37,8 +37,8 @@ module AhaBuilderCore
|
|
|
37
37
|
|
|
38
38
|
def add_routes
|
|
39
39
|
route <<~RUBY
|
|
40
|
-
get "login", to: "sessions#new", as: :
|
|
41
|
-
get "callback", to: "sessions#callback", as: :
|
|
40
|
+
get "login", to: "sessions#new", as: :login
|
|
41
|
+
get "callback", to: "sessions#callback", as: :login_callback
|
|
42
42
|
delete "logout", to: "sessions#logout", as: :logout
|
|
43
43
|
RUBY
|
|
44
44
|
end
|
|
@@ -51,7 +51,7 @@ module AhaBuilderCore
|
|
|
51
51
|
<<-RUBY
|
|
52
52
|
inertia_share auth: -> {
|
|
53
53
|
{
|
|
54
|
-
user: current_user&.as_json(only: %i[id email first_name last_name])
|
|
54
|
+
user: current_user&.as_json(only: %i[id email first_name last_name avatar_url])
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
RUBY
|
|
@@ -82,6 +82,7 @@ module AhaBuilderCore
|
|
|
82
82
|
email: string
|
|
83
83
|
first_name: string | null
|
|
84
84
|
last_name: string | null
|
|
85
|
+
avatar_url: string | null
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
export interface SharedData {
|
|
@@ -111,6 +112,7 @@ module AhaBuilderCore
|
|
|
111
112
|
email:string
|
|
112
113
|
first_name:string
|
|
113
114
|
last_name:string
|
|
115
|
+
avatar_url:string
|
|
114
116
|
email_verified:boolean
|
|
115
117
|
]
|
|
116
118
|
end
|
|
@@ -5,6 +5,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
|
|
|
5
5
|
t.string :email, null: false
|
|
6
6
|
t.string :first_name
|
|
7
7
|
t.string :last_name
|
|
8
|
+
t.string :avatar_url
|
|
8
9
|
t.boolean :email_verified, default: false, null: false
|
|
9
10
|
<% custom_attributes.each do |attribute| -%>
|
|
10
11
|
<% unless attribute.virtual? -%>
|
|
@@ -19,6 +19,7 @@ class SessionsController < ApplicationController
|
|
|
19
19
|
email: result[:user]["email"],
|
|
20
20
|
first_name: result[:user]["first_name"],
|
|
21
21
|
last_name: result[:user]["last_name"],
|
|
22
|
+
avatar_url: result[:user]["avatar_url"],
|
|
22
23
|
email_verified: result[:user]["email_verified"]
|
|
23
24
|
)
|
|
24
25
|
|
|
@@ -29,11 +30,11 @@ class SessionsController < ApplicationController
|
|
|
29
30
|
state = JSON.parse(params[:state]) rescue {}
|
|
30
31
|
redirect_to state["return_to"] || root_path
|
|
31
32
|
else
|
|
32
|
-
redirect_to
|
|
33
|
+
redirect_to login_path, alert: "Authentication failed. Please try again."
|
|
33
34
|
end
|
|
34
35
|
rescue Aha::Auth::ApiError => e
|
|
35
36
|
Rails.logger.error "Authentication failed: #{e.message}"
|
|
36
|
-
redirect_to
|
|
37
|
+
redirect_to login_path, alert: "Authentication failed. Please try again."
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def logout
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aha_builder_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aha! Labs Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|