mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 23:58:06 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
545462e964 | ||
|
|
42df192df8 | ||
|
|
7f451ed9cc | ||
|
|
27fe3023ae | ||
|
|
41d416a18e | ||
|
|
c36cd84c31 | ||
|
|
fd96335d05 |
@@ -1,3 +1,9 @@
|
||||
== 1.0.3
|
||||
|
||||
* enhancements
|
||||
* HTML e-mails now have proper formatting
|
||||
* Do not remove MongoMapper options in find
|
||||
|
||||
== 1.0.2
|
||||
|
||||
* enhancements
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -43,7 +43,7 @@ begin
|
||||
s.homepage = "http://github.com/plataformatec/devise"
|
||||
s.description = "Flexible authentication solution for Rails with Warden"
|
||||
s.authors = ['José Valim', 'Carlos Antônio']
|
||||
s.files = FileList["[A-Z]*", "{app,config,generators,lib}/**/*", "init.rb"]
|
||||
s.files = FileList["[A-Z]*", "{app,config,generators,lib}/**/*", "rails/init.rb"]
|
||||
s.add_dependency("warden", "~> 0.9.3")
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Welcome <%= @resource.email %>!
|
||||
<p>Welcome <%= @resource.email %>!</p>
|
||||
|
||||
You can confirm your account through the link below:
|
||||
<p>You can confirm your account through the link below:</p>
|
||||
|
||||
<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Hello <%= @resource.email %>!
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
Someone has requested a link to change your password, and you can do this through the link below.
|
||||
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
||||
|
||||
<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
||||
|
||||
If you didn't request this, please ignore this email.
|
||||
Your password won't change until you access the link above and create a new one.
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Hello <%= @resource.email %>!
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
|
||||
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
||||
|
||||
Click the link below to unlock your account:
|
||||
<p>Click the link below to unlock your account:</p>
|
||||
|
||||
<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
|
||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{devise}
|
||||
s.version = "1.0.2"
|
||||
s.version = "1.0.3"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Jos\303\251 Valim", "Carlos Ant\303\264nio"]
|
||||
s.date = %q{2010-02-17}
|
||||
s.date = %q{2010-02-23}
|
||||
s.description = %q{Flexible authentication solution for Rails with Warden}
|
||||
s.email = %q{contact@plataformatec.com.br}
|
||||
s.extra_rdoc_files = [
|
||||
@@ -50,7 +50,6 @@ Gem::Specification.new do |s|
|
||||
"generators/devise_install/templates/devise.rb",
|
||||
"generators/devise_views/USAGE",
|
||||
"generators/devise_views/devise_views_generator.rb",
|
||||
"init.rb",
|
||||
"lib/devise.rb",
|
||||
"lib/devise/controllers/helpers.rb",
|
||||
"lib/devise/controllers/internal_helpers.rb",
|
||||
@@ -95,7 +94,8 @@ Gem::Specification.new do |s|
|
||||
"lib/devise/strategies/rememberable.rb",
|
||||
"lib/devise/strategies/token_authenticatable.rb",
|
||||
"lib/devise/test_helpers.rb",
|
||||
"lib/devise/version.rb"
|
||||
"lib/devise/version.rb",
|
||||
"rails/init.rb"
|
||||
]
|
||||
s.homepage = %q{http://github.com/plataformatec/devise}
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module Devise
|
||||
autoload :FailureApp, 'devise/failure_app'
|
||||
autoload :Models, 'devise/models'
|
||||
autoload :Schema, 'devise/schema'
|
||||
autoload :TestHelpers, 'devise/test_helpers'
|
||||
|
||||
|
||||
@@ -22,14 +22,11 @@ module Devise
|
||||
end
|
||||
|
||||
def find(*args)
|
||||
options = args.extract_options!
|
||||
case args.first
|
||||
when :first
|
||||
first(options)
|
||||
when :all
|
||||
all(options)
|
||||
else
|
||||
super
|
||||
when :first, :all
|
||||
send(args.shift, *args)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ module Devise
|
||||
if resource = mapping.to.authenticate_with_http(username, password)
|
||||
success!(resource)
|
||||
else
|
||||
custom!([401, custom_headers, ["HTTP Basic: Access denied.\n"]])
|
||||
custom!([401, custom_headers, [response_body]])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,6 +24,12 @@ module Devise
|
||||
decode_credentials(request).split(/:/, 2)
|
||||
end
|
||||
|
||||
def response_body
|
||||
body = "HTTP Basic: Access denied."
|
||||
method = :"to_#{request_format.to_sym}"
|
||||
{}.respond_to?(method) ? { :error => body }.send(method) : body
|
||||
end
|
||||
|
||||
def http_authentication
|
||||
request.env['HTTP_AUTHORIZATION'] ||
|
||||
request.env['X-HTTP_AUTHORIZATION'] ||
|
||||
@@ -38,10 +44,14 @@ module Devise
|
||||
|
||||
def custom_headers
|
||||
{
|
||||
"Content-Type" => Mime::Type.lookup_by_extension(request.template_format.to_s).to_s,
|
||||
"Content-Type" => request_format.to_s,
|
||||
"WWW-Authenticate" => %(Basic realm="#{Devise.http_authentication_realm.gsub(/"/, "")}")
|
||||
}
|
||||
end
|
||||
|
||||
def request_format
|
||||
@request_format ||= Mime::Type.lookup_by_extension(request.template_format.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Devise
|
||||
VERSION = "1.0.2".freeze
|
||||
VERSION = "1.0.3".freeze
|
||||
end
|
||||
|
||||
@@ -20,6 +20,8 @@ class HttpAuthenticationTest < ActionController::IntegrationTest
|
||||
sign_in_as_new_user_with_http("unknown", "123456", :xml)
|
||||
assert_equal 401, status
|
||||
assert_equal "application/xml", headers["Content-Type"]
|
||||
# Cannot assert this due to a bug between integration tests and rack on 2.3
|
||||
# assert response.body.include?("<error>HTTP Basic: Access denied.</error>")
|
||||
end
|
||||
|
||||
test 'returns a custom response with www-authenticate and chosen realm' do
|
||||
|
||||
Reference in New Issue
Block a user