Skip to content

Commit 9462b97

Browse files
committed
Send the identity + token when validating a magic link code
1 parent 92edac3 commit 9462b97

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

app/controllers/sessions/magic_links_controller.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ def respond_to_valid_code_from(magic_link)
3030
end
3131

3232
format.json do
33-
render json: {
34-
email_address: magic_link.identity.email_address,
35-
users: magic_link.identity.users,
36-
session_token: cookies[:session_token]
37-
}
33+
@identity = magic_link.identity
3834
end
3935
end
4036
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
json.session_token cookies[:session_token]
2+
json.email_address @identity.email_address
3+
json.accounts @identity.users do |user|
4+
json.partial! "identities/account", account: user.account
5+
json.user do
6+
json.partial! "users/user", user: user
7+
end
8+
end

0 commit comments

Comments
 (0)