sinatra-security 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.
- data/VERSION +1 -1
- data/lib/sinatra/security.rb +2 -8
- data/sinatra-security.gemspec +2 -2
- data/test/test_sinatra-security.rb +7 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/sinatra/security.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
|
3
|
-
begin
|
4
|
-
require 'haml'
|
5
|
-
rescue LoadError
|
6
|
-
raise "In order to use sinatra/security, make sure you have haml installed"
|
7
|
-
end
|
8
|
-
|
9
3
|
module Sinatra
|
10
4
|
module Security
|
11
5
|
autoload :Helpers, 'sinatra/security/helpers'
|
@@ -23,11 +17,11 @@ module Sinatra
|
|
23
17
|
redirect_to_stored
|
24
18
|
else
|
25
19
|
session[:error] = "Wrong Username/Email and Password combination."
|
26
|
-
|
20
|
+
redirect '/login'
|
27
21
|
end
|
28
22
|
end
|
29
23
|
end
|
30
24
|
end
|
31
25
|
|
32
26
|
register Security
|
33
|
-
end
|
27
|
+
end
|
data/sinatra-security.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-security}
|
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 = ["Cyril David"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-18}
|
13
13
|
s.description = %q{For use with Sinatra + Monk + OHM}
|
14
14
|
s.email = %q{cyx.ucron@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -4,6 +4,10 @@ class BasicApp < Sinatra::Base
|
|
4
4
|
use Rack::Session::Cookie
|
5
5
|
|
6
6
|
register Sinatra::Security
|
7
|
+
|
8
|
+
get '/login' do
|
9
|
+
"<h1>Login Page</h1>"
|
10
|
+
end
|
7
11
|
|
8
12
|
get '/public' do
|
9
13
|
"Hello Public World"
|
@@ -127,9 +131,9 @@ class TestSinatraSecurity < Test::Unit::TestCase
|
|
127
131
|
post '/login', username: 'quentin', password: 'test'
|
128
132
|
end
|
129
133
|
|
130
|
-
should "redirect
|
131
|
-
|
134
|
+
should "redirect to /login" do
|
135
|
+
assert_equal 302, last_response.status
|
136
|
+
assert_equal '/login', last_response.headers['Location']
|
132
137
|
end
|
133
|
-
|
134
138
|
end
|
135
139
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Cyril David
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-18 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|