summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/sessions_controller.rb6
-rw-r--r--app/controllers/api/user_accounts_controller.rb2
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/api/sessions_controller.rb b/app/controllers/api/sessions_controller.rb
index 9d0e4ac..64d5464 100644
--- a/app/controllers/api/sessions_controller.rb
+++ b/app/controllers/api/sessions_controller.rb
@@ -2,7 +2,9 @@
module Api
# The controller that handles authentications.
- class SessionsController < ApplicationController
+ class SessionsController < AuthenticatedController
+ skip_before_action :validate_jwt, only: [:create]
+
def create
@user_account = UserAccount.find_by(email: permitted_params[:email])
@@ -14,7 +16,7 @@ module Api
end
def destroy
- user_account.update_attribute(:session_key, nil)
+ current_user_account.update_attribute(:session_key, nil)
render status: :no_content
end
diff --git a/app/controllers/api/user_accounts_controller.rb b/app/controllers/api/user_accounts_controller.rb
index ca5d93b..85323df 100644
--- a/app/controllers/api/user_accounts_controller.rb
+++ b/app/controllers/api/user_accounts_controller.rb
@@ -6,7 +6,7 @@ module Api
skip_before_action :validate_jwt, only: [:create]
def show
- render json: serialized_user_account.serializable_hash
+ render json: Serializers::UserAccountSerializer.new(current_user_account).serializable_hash
end
def create