simple_auth 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/Rakefile +1 -7
- data/lib/simple_auth.rb +6 -5
- data/lib/simple_auth/action_controller.rb +1 -1
- data/lib/simple_auth/session.rb +4 -0
- data/lib/simple_auth/version.rb +1 -1
- data/simple_auth.gemspec +4 -4
- data/spec/resources/controllers.rb +1 -1
- data/spec/simple_auth/action_controller_spec.rb +1 -1
- data/spec/simple_auth/session_spec.rb +5 -0
- metadata +13 -7
- data/VERSION +0 -1
data/README.markdown
CHANGED
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
|
-
|
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
|
data/lib/simple_auth.rb
CHANGED
@@ -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[:
|
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
|
data/lib/simple_auth/session.rb
CHANGED
data/lib/simple_auth/version.rb
CHANGED
data/simple_auth.gemspec
CHANGED
@@ -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.
|
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-
|
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.
|
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[:
|
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[:
|
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
|
-
|
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-
|
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:
|
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.
|
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
|