mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-22 11:46:02 +10:00
18 lines
436 B
Ruby
18 lines
436 B
Ruby
class Api::V1::SessionsController < Devise::SessionsController
|
|
skip_before_action :verify_authenticity_token
|
|
def create
|
|
warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#failure")
|
|
render json: user_json
|
|
end
|
|
|
|
|
|
def destroy
|
|
sign_out(resource_name)
|
|
end
|
|
|
|
def failure
|
|
render :json => {:success => false, :errors => '用户名或者密码错误,请重试'}, status: :forbidden
|
|
end
|
|
|
|
end
|