Module: MerbAuthSlicePassword

Defined in:
lib/merb-auth-slice-password.rb

Overview

All Slice code is expected to be namespaced inside a module

Defined Under Namespace

Modules: ExceptionsMixin Classes: Application, Sessions

Class Method Summary collapse

Class Method Details

.activateObject

Activation hook - runs after AfterAppLoads BootLoader



45
46
47
# File 'lib/merb-auth-slice-password.rb', line 45

def self.activate
  # Load the default strategies
end

.deactivateObject

Deactivation hook - triggered by Merb::Slices.deactivate(MerbAuthSlicePassword)



50
51
# File 'lib/merb-auth-slice-password.rb', line 50

def self.deactivate
end

.initObject

Initialization hook - runs before AfterAppLoads BootLoader



37
38
39
40
41
42
# File 'lib/merb-auth-slice-password.rb', line 37

def self.init
  require "merb-auth-more/mixins/redirect_back"
  unless ::Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies]
    ::Merb::Authentication.activate!(:default_password_form)
  end
end

.loadedObject

Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.



33
34
# File 'lib/merb-auth-slice-password.rb', line 33

def self.loaded
end

.setup_router(scope) ⇒ Object

Note:

prefix your named routes with :mauth_password_slice_ to avoid potential conflicts with global named routes.

Setup routes inside the host application

Parameters:

  • scope (Merb::Router::Behaviour)

    Routes will be added within this scope (namespace). In fact, any router behaviour is a valid namespace, so you can attach routes at any level of your router setup.



62
63
64
65
66
67
# File 'lib/merb-auth-slice-password.rb', line 62

def self.setup_router(scope)
  # example of a named route
  scope.match("/login", :method => :get ).to(:controller => "/exceptions",  :action => "unauthenticated").name(:login)
  scope.match("/login", :method => :put ).to(:controller => "sessions",     :action => "update"         ).name(:perform_login)
  scope.match("/logout"                 ).to(:controller => "sessions",     :action => "destroy"        ).name(:logout)
end