mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
API endpoint for retrieving the current user
This commit is contained in:
@ -55,6 +55,14 @@ class SessionController < ApplicationController
|
||||
render json: {result: "ok"}
|
||||
end
|
||||
|
||||
def current
|
||||
if current_user.present?
|
||||
render_serialized(current_user, CurrentUserSerializer)
|
||||
else
|
||||
render nothing: true, status: 404
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
reset_session
|
||||
log_off_user
|
||||
|
Reference in New Issue
Block a user