Class: TokenAuth::AuthenticationTokensController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/token_auth/authentication_tokens_controller.rb

Overview

Manages Authentication Tokens.

Instance Method Summary collapse

Instance Method Details

#destroyObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/token_auth/authentication_tokens_controller.rb', line 21

def destroy
  token = AuthenticationToken.find_by(entity_id: params[:entity_id])

  if token.destroy
    redirect_to tokens_url(token.entity_id),
                notice: t("activerecord.success_destroying",
                          name: token.class.model_name.human)
  else
    redirect_to tokens_url(token.entity_id),
                alert: t("activerecord.failure_destroying",
                         name: token.class.model_name.human,
                         errors: errors_on(token))
  end
end

#updateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/token_auth/authentication_tokens_controller.rb', line 6

def update
  token = AuthenticationToken.find_by(entity_id: params[:entity_id])

  if token.update(token_params)
    redirect_to tokens_url(token.entity_id),
                notice: t("activerecord.success_saving",
                          name: token.class.model_name.human)
  else
    redirect_to tokens_url(token.entity_id),
                alert: t("activerecord.failure_saving",
                         name: token.class.model_name.human,
                         errors: errors_on(token))
  end
end