Class: Notee::TokensController

Inherits:
ApplicationController show all
Defined in:
app/controllers/notee/tokens_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /tokens



13
14
15
16
17
18
19
20
21
# File 'app/controllers/notee/tokens_controller.rb', line 13

def create
  if Notee.notee_id == params[:id] && Notee.notee_password == params[:password]
    if token = Token.create!
      session[:access_token] = token.access_token
    end
  end

  redirect_to root_path
end

#destroyObject

DELETE /tokens/1



24
25
26
27
# File 'app/controllers/notee/tokens_controller.rb', line 24

def destroy
  Token.find_by_access_token(session[:access_token]).destroy!
  session.delete(:access_token)
end

#newObject

GET /tokens/new



9
10
# File 'app/controllers/notee/tokens_controller.rb', line 9

def new
end