Module: Passage::Auth::PassPhrase

Defined in:
lib/passage/auth/pass_phrase/pass_phrase.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/passage/auth/pass_phrase/pass_phrase.rb', line 22

def self.registered(app)
  app.helpers Helpers

  app.get '/login' do
    "<form method='POST' action='/login'>" +
    "Your pass phrase<br/><input type='text' name='phrase'>" +
    "<input type='submit'/></form>"
  end

  app.post '/login' do
    if params[:phrase] == 'foo'
      session[:authorized] = true
      redirect '/'
    else
      session[:authorized] = nil
      redirect '/login'
    end
  end
end