Module: Ramaze::Helper::Auth

Includes:
Traited
Defined in:
lib/ramaze/helper/auth.rb

Overview

A simple way to do authentication without a model. Please have a look at the docs of Auth#auth_login.

If you want to do authentication with a model see Helper::User instead.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(into) ⇒ Object



19
20
21
# File 'lib/ramaze/helper/auth.rb', line 19

def self.included(into)
  into.helper(:stack)
end

Instance Method Details

#loginObject



23
24
25
26
27
28
# File 'lib/ramaze/helper/auth.rb', line 23

def 
  return auth_template if trait[:auth_post_only] and !request.post?
  @username, password = request[:username, :password]
  answer(request.referer) if (@username, password)
  return auth_template
end

#logoutObject



30
31
32
33
# File 'lib/ramaze/helper/auth.rb', line 30

def logout
  auth_logout
  answer(request.referer)
end