Chore: Render avatar url in validate token method (#448)

This commit is contained in:
Sojan Jose
2020-01-27 00:59:51 +05:45
committed by Pranav Raj S
parent 6325acd183
commit 199642d3bd
7 changed files with 59 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
class ConfirmationsController < Devise::ConfirmationsController
class Devise::ConfirmationsController < Devise::ConfirmationsController
skip_before_action :require_no_authentication, raise: false
skip_before_action :authenticate_user!, raise: false

View File

@@ -1,4 +1,4 @@
class PasswordsController < Devise::PasswordsController
class Devise::PasswordsController < Devise::PasswordsController
include AuthHelper
skip_before_action :require_no_authentication, raise: false

View File

@@ -1,4 +1,4 @@
class SessionsController < ::DeviseTokenAuth::SessionsController
class Devise::SessionsController < ::DeviseTokenAuth::SessionsController
# Prevent session parameter from being passed
# Unpermitted parameter: session
wrap_parameters format: []

View File

@@ -0,0 +1,10 @@
class Devise::TokenValidationsController < ::DeviseTokenAuth::TokenValidationsController
def validate_token
# @resource will have been set by set_user_by_token concern
if @resource
render 'devise/token.json'
else
render_validate_token_error
end
end
end

View File

@@ -0,0 +1,17 @@
json.payload do
json.success true
json.data do
json.id @resource.id
json.provider @resource.provider
json.uid @resource.uid
json.name @resource.name
json.nickname @resource.nickname
json.email @resource.email
json.account_id @resource.account_id
json.pubsub_token @resource.pubsub_token
json.role @resource.role
json.inviter_id @resource.inviter_id
json.confirmed @resource.confirmed?
json.avatar_url @resource.avatar_url
end
end