Skip to content

Instantly share code, notes, and snippets.

@hassox
Created November 10, 2008 22:13
Show Gist options
  • Save hassox/23659 to your computer and use it in GitHub Desktop.
Save hassox/23659 to your computer and use it in GitHub Desktop.
# This file is specifically for you to define your strategies
#
# You should declare you strategies directly and/or use
# Merb::Authentication.activate!(:label_of_strategy)
#
# To load and set the order of strategy processing
Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies] = true
module Merb::Authentication::Strategies
class UserAuthentication < Merb::Authentication::Strategy
def run!
if params[:username] and params[:password]
user = User.auth(params[:username], params[:password])
if !user
request.session.authentication.errors.add('username',
"Brukernavn og/eller password var feil")
end
user
end
end
end
end
Merb::Plugins.config[:"merb-auth"][:login_param] = :username
# This file is specifically for you to define your strategies
#
# You should declare you strategies directly and/or use
# Merb::Authentication.activate!(:label_of_strategy)
#
# To load and set the order of strategy processing
Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies] = true
Merb::Authentication.activate!(:default_password_form)
module Merb::Authentication::Strategies
class Basic::Form < Basic::Base
def strategy_error_message
"Brukernavn og/eller password var feil"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment