simple_auth 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,7 +73,7 @@ After you set up the model, you can go the controller.
73
73
  if @user_session.save
74
74
  redirect_to dashboard_path
75
75
  else
76
- flash[:warning] = "Invalid username or password"
76
+ flash[:alert] = "Invalid username or password"
77
77
  render :new
78
78
  end
79
79
  end
data/Rakefile CHANGED
@@ -30,10 +30,4 @@ TXT
30
30
  gem.files = %w(Rakefile simple_auth.gemspec init.rb VERSION README.markdown) + Dir["{generators,lib,spec,app,config}/**/*"]
31
31
  end
32
32
 
33
- desc "Generate gemspec and build gem"
34
- task :build_gem do
35
- File.open("VERSION", "w+") {|f| f << SimpleAuth::Version::STRING }
36
-
37
- Rake::Task["gemspec"].invoke
38
- Rake::Task["build"].invoke
39
- end
33
+ Jeweler::GemcutterTasks.new
@@ -1,5 +1,6 @@
1
1
  require "digest/sha2"
2
2
  require "simple_auth/config"
3
+ require "simple_auth/action_controller"
3
4
  require "simple_auth/active_record"
4
5
  require "simple_auth/session"
5
6
  require "simple_auth/version"
@@ -8,11 +9,11 @@ module SimpleAuth
8
9
  class NotAuthorized < Exception; end
9
10
  end
10
11
 
11
- ActiveRecord::Base.send :include, SimpleAuth::ActiveRecord::InstanceMethods
12
- ActiveRecord::Base.send :extend, SimpleAuth::ActiveRecord::ClassMethods
12
+ ::ActiveRecord::Base.send :include, SimpleAuth::ActiveRecord::InstanceMethods
13
+ ::ActiveRecord::Base.send :extend, SimpleAuth::ActiveRecord::ClassMethods
13
14
 
14
- ActionController::Base.send :include, SimpleAuth::ActionController::Implementation
15
- ActionController::Base.send :include, SimpleAuth::ActionController::InstanceMethods
16
- ActionController::Base.send :extend, SimpleAuth::ActionController::ClassMethods
15
+ ::ActionController::Base.send :include, SimpleAuth::ActionController::Implementation
16
+ ::ActionController::Base.send :include, SimpleAuth::ActionController::InstanceMethods
17
+ ::ActionController::Base.send :extend, SimpleAuth::ActionController::ClassMethods
17
18
 
18
19
  I18n.load_path += Dir[File.dirname(__FILE__) + "/../config/locales/*.yml"]
@@ -54,7 +54,7 @@ module SimpleAuth
54
54
  path = simple_auth_path(c, options[:to])
55
55
 
56
56
  unless logged_in? && authorized?
57
- flash[:warning] = I18n.translate("simple_auth.sessions.need_to_be_logged")
57
+ flash[:alert] = I18n.translate("simple_auth.sessions.need_to_be_logged")
58
58
  session[:return_to] = request.request_uri if request.get?
59
59
  redirect_to path
60
60
  end
@@ -29,6 +29,10 @@ module SimpleAuth
29
29
  def empty?
30
30
  @errors.empty?
31
31
  end
32
+
33
+ def [](attr_name)
34
+ []
35
+ end
32
36
  end
33
37
 
34
38
  def self.find
@@ -2,7 +2,7 @@ module SimpleAuth
2
2
  module Version
3
3
  MAJOR = "0"
4
4
  MINOR = "1"
5
- PATCH = "4"
5
+ PATCH = "5"
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simple_auth}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nando Vieira"]
12
- s.date = %q{2010-01-27}
12
+ s.date = %q{2010-03-30}
13
13
  s.description = %q{When Authlogic & Devise are just too much.
14
14
  }
15
15
  s.email = %q{fnando.vieira@gmail.com}
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  "README.markdown",
21
21
  "Rakefile",
22
- "VERSION",
23
22
  "app/helpers/simple_auth_helper.rb",
24
23
  "config/locales/en.yml",
25
24
  "config/locales/pt.yml",
@@ -44,10 +43,11 @@ Gem::Specification.new do |s|
44
43
  "spec/simple_auth/simple_auth_helper_spec.rb",
45
44
  "spec/spec_helper.rb"
46
45
  ]
46
+ s.has_rdoc = false
47
47
  s.homepage = %q{http://github.com/fnando/simple_auth}
48
48
  s.rdoc_options = ["--charset=UTF-8"]
49
49
  s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.3.5}
50
+ s.rubygems_version = %q{1.3.6}
51
51
  s.summary = %q{A simple authentication system for Rails apps}
52
52
  s.test_files = [
53
53
  "spec/resources/controllers.rb",
@@ -19,7 +19,7 @@ class SessionController < ActionController::Base
19
19
  if @user_session.save
20
20
  redirect_to session.delete(:return_to) || dashboard_path
21
21
  else
22
- flash[:warning] = "Invalid login/password."
22
+ flash[:alert] = "Invalid login/password."
23
23
  render :new
24
24
  end
25
25
  end
@@ -30,7 +30,7 @@ describe SimpleAuth::ActionController, :type => :controller do
30
30
 
31
31
  it "should set warning message" do
32
32
  get :index
33
- flash[:warning].should == "You need to be logged"
33
+ flash[:alert].should == "You need to be logged"
34
34
  end
35
35
 
36
36
  it "should redirect when user is not authorized" do
@@ -100,6 +100,11 @@ describe SimpleAuth::Session do
100
100
  @user_session.errors.on(:password).should be_nil
101
101
  end
102
102
 
103
+ it "should return empty array when trying to get errors by using hash syntax" do
104
+ @user_session.errors[:credential].should be_empty
105
+ @user_session.errors[:password].should be_empty
106
+ end
107
+
103
108
  it "should have errors" do
104
109
  @user_session.errors.should_not be_empty
105
110
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 5
9
+ version: 0.1.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - Nando Vieira
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-27 00:00:00 -02:00
17
+ date: 2010-03-30 00:00:00 -03:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -26,7 +31,6 @@ extra_rdoc_files:
26
31
  files:
27
32
  - README.markdown
28
33
  - Rakefile
29
- - VERSION
30
34
  - app/helpers/simple_auth_helper.rb
31
35
  - config/locales/en.yml
32
36
  - config/locales/pt.yml
@@ -50,7 +54,7 @@ files:
50
54
  - spec/simple_auth/session_spec.rb
51
55
  - spec/simple_auth/simple_auth_helper_spec.rb
52
56
  - spec/spec_helper.rb
53
- has_rdoc: true
57
+ has_rdoc: false
54
58
  homepage: http://github.com/fnando/simple_auth
55
59
  licenses: []
56
60
 
@@ -63,18 +67,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
67
  requirements:
64
68
  - - ">="
65
69
  - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
66
72
  version: "0"
67
- version:
68
73
  required_rubygems_version: !ruby/object:Gem::Requirement
69
74
  requirements:
70
75
  - - ">="
71
76
  - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
72
79
  version: "0"
73
- version:
74
80
  requirements: []
75
81
 
76
82
  rubyforge_project:
77
- rubygems_version: 1.3.5
83
+ rubygems_version: 1.3.6
78
84
  signing_key:
79
85
  specification_version: 3
80
86
  summary: A simple authentication system for Rails apps
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.4