summaryrefslogtreecommitdiff
path: root/app/controllers/home_controller.rb
blob: 25a5052a5f09c77e958108fb7c4da4fe5968f6c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class HomeController < ApplicationController
  before_filter :load_auth

  def index
    @now = @authenticator.now
    @url = @authenticator.provisioning_uri("mokha@cisco.com").to_s
  end

  def login
    if @authenticator.verify(params[:token])
      redirect_to root_path, notice: "you're in my friend!"
    else
      redirect_to root_path, notice: "invalid token"
    end
  end

  private 

  def load_auth
    @authenticator = ROTP::TOTP.new("JBSWY3DPEHPK3PXP")
  end
end