Included Modules

Class/Module Index [+]

Quicksearch

Ramaze::Helper::Auth

The Auth helper can be used for authentication without using a model. This can be useful when working with very basic applications that don’t require database access.

If you’re looking for a way to do authentication using a model you should take a look at Helper::User instead.

Public Class Methods

included(into) click to toggle source
# File lib/ramaze/helper/auth.rb, line 22
def self.included(into)
  into.helper(:stack)
end

Public Instance Methods

login() click to toggle source

Log a user in based on the :username and :password key in the request hash.

@return [String] The login template in case the user’s login data was

incorrect.
# File lib/ramaze/helper/auth.rb, line 33
def login
  if trait[:auth_post_only] and !request.post?
    return auth_template
  end

  @username, password = request[:username, :password]

  answer(request.referer) if auth_login(@username, password)

  return auth_template
end
logout() click to toggle source

Log the user out and redirect him back to the previous page.

# File lib/ramaze/helper/auth.rb, line 48
def logout
  auth_logout
  redirect_referrer
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.