Class: Locomotive::Api::TokensController
Instance Method Summary
collapse
#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks
Instance Method Details
#create ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'app/controllers/locomotive/api/tokens_controller.rb', line 7
def create
begin
token = Account.create_api_token(current_site, params[:email], params[:password])
respond_with({ token: token }, location: root_url)
rescue Exception => e
respond_with({ message: e.message }, status: 401, location: root_url)
end
end
|
#destroy ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'app/controllers/locomotive/api/tokens_controller.rb', line 16
def destroy
begin
token = Account.invalidate_api_token(params[:id])
respond_with({ token: token }, location: root_url)
rescue Exception => e
respond_with({ message: e.message }, status: 404, location: root_url)
end
end
|