ToolJet/app/controllers/authentication_controller.rb

14 lines
383 B
Ruby
Raw Normal View History

2021-03-31 16:18:42 +00:00
class AuthenticationController < ApplicationController
skip_before_action :authenticate_request
def authenticate
command = AuthenticateUser.call(params[:email], params[:password])
if command.success?
render json: { auth_token: command.result }
else
render json: { error: command.errors }, status: :unauthorized
end
end
end