Class: Peoplefinder::TokensController

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

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/peoplefinder/tokens_controller.rb', line 6

def create
  @token = Token.new(token_params)
  if @token.save
    TokenMailer.new_token_email(@token).deliver
    render
  else
    render action: :new
  end
end

#showObject



16
17
18
19
20
21
22
23
# File 'app/controllers/peoplefinder/tokens_controller.rb', line 16

def show
  token = Token.where(value: params[:id]).first
  return forbidden unless token

  person = Person.from_token(token)
  session['current_user_id'] = person.id
  redirect_to_desired_path
end